in reply to Unable to extract elements from a split. Kindly Help.
Get rid of the single quotes around the regular expressions used as the first operand to split.
I know you said that ping is just an example, but backticks in list context should give you an array of lines of output anyway, so you probably don't even need the first split. I'm not sure what you hope to accomplish with the second; if you remove the single quotes, it'll split on every word character, and you're not capturing them. Perhaps my @eachwordcmd = split ' ', $line; would work better?
Improve your skills with Modern Perl: the free book.
|
|---|