Front page | perl.beginners |
Postings from July 2011
first post
Thread Next
From:
H Kern
Date:
July 20, 2011 19:28
Subject:
first post
Message ID:
op.vyx6g4peneqaw9@pbw-cpqpf756nr
Hi, My first newbie post. I wish to have two arrays indexed by a hash
table. The simple program below runs and behaves properly initializing the
hash table with the information I wish it to have.
However, Perl generates the following suggestion on the @header{}
assignment statements,
"Scalar value @header{"keys"} better written as $header{"keys"} at
iifm.pl line..."
If I rewrite it as Perl suggests, the two %header{} elements get
initialized to the size of the arrays instead of the arrays. Why does Perl
make this suggestion, and how do I get rid of it without getting rid of
the "use warnings" statement?
Thanks, --H
use strict;
use warnings;
my %header;
open( IN, "<", $ARGV[0] );
@header{"keys"} = split(/\t\n/, <IN>);
@header{"info"} = split(/\t\n/, <IN>);
Thread Next