in reply to Global vs. Local Variables Assistance Requested

Like this?
#!/usr/bin/perl my $head; open(my $fh, '<', "funtime.dat") or die $!; while(my $line = <$fh>) { chomp($line); my @data = split(/,/, $line); if (($data[2] eq "D")||($data[2] eq "C")) { print(" > $head.txt\n") if defined($head); print("type $data[2]"); $head = $data[1]; } print(" $data[1].txt"); } print(" > $head.txt\n") if defined($head);

Replies are listed 'Best First'.
Re^2: Global vs. Local Variables Assistance Requested
by Knoperl (Acolyte) on Dec 04, 2008 at 22:55 UTC
    Dear ikegami,

    That was perfect. Thank you very much!

    How quick is the wonderful PerlMonks in their righteousness!