in reply to Working with text files, thinking my issue is with variables inside if loops
while (<FILE>) { next unless /\S/; # Skip whitespace lines if (/^ \s* Daniel \s+ Lastname \s* $/x) { $printto = "Daniel"; } elsif (/^ \s* Steffi \s+ Lastname \s* $/x) { $printto = "Steffi"; } elsif ($printto eq "Daniel") { print DANIEL $_; } elsif ($printto eq "Steffi") { print STEFFI $_; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Working with text files, thinking my issue is with variables inside if loops
by holli (Abbot) on May 24, 2011 at 07:56 UTC |