Have you considered using Proc::ProcessTable instead of doing it yourself?
Update: but for a clue as to what you are doing wrong, try capturing _all_ of the matches in an array and printing that.
foreach ( @i ) { my @proc = /^ (\w+) # capture username \s+ (\d+) # capture PID \s+\d+\s+\d+\s+ (?: # cluster (not capturing) (\d{4}) # capture %Y | # or (\d{2}:\d{2}) # capture %H:%M | # or (\d{2}:\d{2}:\d{2}) # capture %H:%M:%S | # or (\w{3}\d{2}) # capture %b%d | # or (\w{3}\s+\d{2}) # capture %b %d ) \s+\S+\s+\S+\s+ # skip 2 columns after the 5th column (.*) # capture the command $/gx; print join ' / ', @proc; print "\n"; }
"The first rule of Perl club is you do not talk about Perl club." -- Chip Salzenberg
In reply to Re: parsing variable input (perlre problem)
by davorg
in thread parsing variable input (perlre problem)
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |