You don't really need the array for @file1 then, you can just run another while loop over that and save the memory for the array which only got used during initialization of the hash.
You also don't need to chomp the values, as long as you are consistent on whether or not you chomp.
This assumes you actually want to simulate "grep -x" (match whole lines), not find a token anywhere on a line in file2. If that's what you actually want, maybe something like this would work.
The "grep" finds the elements in @RESULTARRAY matching the condition in { } and returns those as a list. If that list has any elements, we print a report. (scalar @matches returns how many elements @matches has.)
This matches regardless of context, so "car" will be matched inside another word, like "scars" or "career". You can dress up the regular expression in the grep some if you want different behavior.
I was tempted to use @INSANELYLONGUPPERCASEVARIABLENAME instead of @matches, but if that's what you want, that's obviously easy to fix. <ducks>
Hi
I need an equivalent command in PERL for the following.
export LC_ALL=C;
I hope this is the command. Please confirm this and correct me if i am wrong
$ENV{LC_ALL}="C";
Thanks and Regards
Ammu (1 Reply)
Dear All,
Good day, can any of you help me in the following problem:
I need to find the perl equivalent for the following commandline
grep characters |awk '{print \$2}'Expecting your reply and thanks in advance.
Warm regards
Fredrick. (4 Replies)
I have to do grep -v in a perl script. I want to exclude blank lines and lines having visitor.
#grep -v visitor abc.txt |grep '.'
file:abc.txt
1340 not booked 16D:D9 tourist 8
1341 not booked 16C:D4 tourist 25
1342 not booked 16D:C4 visitor 7
1343 not booked 01C:D9 visitor 6
1344... (4 Replies)
Hello,
I searched online; it seems that perl use $NR as NR in awk; however it does not work for me. For example, how to re-write the following awk using perl:
awk '{ print NR}' inputfile---------- Post updated at 01:55 PM ---------- Previous update was at 12:49 PM ----------
I found... (2 Replies)
hi Geeks,
my input file contains data like =>
53 - Deewana Kar Raha Hai.mp3
54 - Hale Dil.mp3
55 - Ishq Sufiyana.mp3
56 - Abhi Kuch Dino Se.mp3
57 - Pee Loon Hoto Ki Sargam.mp3
I had used sed command to remove the prefix from the file name like
sed 's/^\
it gives me the perfect... (4 Replies)
Ive been trying to move to Perl. It has been a struggle.
My question is, is there a good resource that explains nesting statements.
As an example.
To change
primary
Factory CTS 1.9.0(46) P1
*Slot 1 CTS 1.10.2(42) P1
To
primary *Slot 1 CTS 1.10.2(42) P1
... (5 Replies)