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/);
  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/


Reply via email to