WWq has asked for the wisdom of the Perl Monks concerning the following question:
An array contains few user IDs. Each user ID is used as a match element in another file. How to match a specific line and array element? And print words at previous line?
The specific line is:
cell ("b05hrn23ud0d3") {array file:
b05bdc00lnz64 b05hrn23ud0d3 b05bgn00lnz00 b05bgn01lnz00
coding:
foreach $a (@arr) { #read each line in array file for (my $count=0; $count <5; $count++) { #iteration for each ID in + array file if(@arr[$count] =~ m/cell\(@arr[$count])){ #match specific line print "aa\n"; #print words at previous line } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl: How to match a line and print words at line immediately above it?
by hdb (Monsignor) on Nov 01, 2013 at 09:07 UTC | |
Re: Perl: How to match a line and print words at line immediately above it?
by Doozer (Scribe) on Nov 01, 2013 at 09:57 UTC | |
by sundialsvc4 (Abbot) on Nov 01, 2013 at 14:59 UTC | |
Re: Perl: How to match a line and print words at line immediately above it?
by davido (Cardinal) on Nov 01, 2013 at 16:40 UTC | |
Re: Perl: How to match a line and print words at line immediately above it?
by Anonymous Monk on Nov 01, 2013 at 09:02 UTC |
Back to
Seekers of Perl Wisdom