> -----Original Message----- > From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] > Sent: Wednesday, December 21, 2011 11:18 AM > To: Binish A.R > Cc: John W. Krahn; Perl Beginners > Subject: Re: parsing data > > I'm trying to implement the advice that Binish, and John gave. > > I am getting the following error: > > Can't use an undefined value as a HASH reference at ./format.pl line > 16, <DATA> line 2. > > Any help is greatly appreciated, > > Chris > > #!/usr/bin/perl > use warnings; > use strict; > > my $csno; > > while( <DATA> ) { > chomp; > > if( $_ =~ /^$/ ) { > my $hash = undef; > next; > } > my ($k, $v) = split(/=/, $_, 2); > $csno = $v, next if ($k =~ /csno/);
You've inadvertently put 'my' on this line. Ken > my $hash->{$csno}->{$k} = $v; > } > > __DATA__ > >csno=1 > rfpi=1 > vrp0=3423000 > vrp1=3423000 > trl=1700000 > line= > low= > high=5 > > >csno=1 > rfpi=2 > vrp0=3423000 > vrp1=3423000 > trl=1700000 > line= > low= > high=5 > > >csno=1 > rfpi=3 > vrp0=3423000 > vrp1=3423000 > trl=1700000 > line= > low= > high=5 > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional > commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/