in reply to Re^3: help with splitting and printing the array
in thread help with splitting and printing the array
It doesn't help, it is just a simpler solution. perlnewbie012215 says about 20 lines hence a simple solution might do the job as well.
BTW your code can be improved by checking the regexp match because it prints out the previous line if the pattern doesn't match:
Or the important command line switches could be checked one by one and add them to the output if they exist.if (/-S.+?($servname).+-D.+?($servname).+-C.+?($servname).+$/) { print "Server after -S: $1; Server after -D: $2; Server after -C: +$3;\n"; } else { print "Unknown record structure: $_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: help with splitting and printing the array
by blindluke (Hermit) on Jan 25, 2015 at 12:41 UTC |