in reply to Re: Constructing a hash - why isn't my regex matching anything
in thread Constructing a hash - why isn't my regex matching anything
I keep getting the below warning
Use of uninitialized value in hash element at hash_construct.pl line 15, <$fh> line 909. Use of uninitialized value in concatenation (.) or string at hash_construct.pl line 11, <$fh> line 910.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; open my $fh, '<', $ARGV[0] or die "could not open $ARGV[0]'' $!"; while (my $line = <$fh>) { $line =~/;(.*)\s-\s/; my $key = $1; print "KEY:$key\n"; $line =~/\.\\(.*)-/; my $value = $1; print "VALUE:$value\n"; $hash{$key}=$value; } print Dumper(\%hash);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Constructing a hash - why isn't my regex matching anything
by Anonymous Monk on Dec 19, 2010 at 08:58 UTC | |
by perl_mystery (Beadle) on Dec 19, 2010 at 09:05 UTC | |
by Anonymous Monk on Dec 19, 2010 at 09:12 UTC | |
by perl_mystery (Beadle) on Dec 19, 2010 at 09:23 UTC | |
by Anonymous Monk on Dec 19, 2010 at 09:37 UTC | |
by Anonymous Monk on Dec 19, 2010 at 10:24 UTC |