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 $_; } }
In reply to Re: Working with text files, thinking my issue is with variables inside if loops
by blakew
in thread Working with text files, thinking my issue is with variables inside if loops
by Steffi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |