in reply to print the values
If you have a choice of print instead of push and print later, print it now!
#!/usr/bin/perl -w use strict; my %names = qw (NAME 1 AGE 1); while(<DATA>) { s/[{}\n]//g; #this substitute gets rid of {} and also #does the job of chomp; print "$_\n" if !exists($names{$_}); } # Prints: # SEX # ADDRESS # ADDRESS __DATA__ {NAME} {AGE} {SEX} {ADDRESS} {ADDRESS}
|
|---|