vineet2004 has asked for the wisdom of the Perl Monks concerning the following question:
hi to all monks....and also to lesser mortals
i am using the below 'if' statement to process a text.
while (<>) { if (/ (\w\w) (\w\w) (\w\w) (\w\w) /) { #do smthing } 00 12 0d 90
the above text is part of a larger log file which i havent shown here. i am not wrong the 'which(<>)' command does line by line processing. so i intend to assign each pair of digits a variable like $1,$2 etc ...which i can later manipulate in my code. another such line might contain 3 pairs instead of 4 and yet another might contain 2 pairs.but i am only able to use the line having 4 pairs like the one shown above and none of the other lines having pairs less than 4.
what can i do to be able to include the line with less than 4 pairs also.
awaiting ur replies
thanks
vineet
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pattern matching
by liverpole (Monsignor) on Dec 25, 2006 at 13:54 UTC | |
by bart (Canon) on Dec 25, 2006 at 18:54 UTC | |
by vineet2004 (Initiate) on Dec 26, 2006 at 04:38 UTC | |
by vineet2004 (Initiate) on Dec 26, 2006 at 07:23 UTC | |
by bart (Canon) on Dec 26, 2006 at 22:47 UTC | |
|
Re: pattern matching
by throop (Chaplain) on Dec 26, 2006 at 04:14 UTC |