in reply to more elegant way to parse this?
Hi morgon,
Elegance is in the eye of the beholder, I reckon. Personally I sometimes find it more elegant to decompose things into neat little units than to combine everything into one operation.
Output:use strict; use warnings; use feature 'say'; my $input = do { local $/; <DATA> }; my @output = map { /(\S+)$/ } grep { /SSID/ } split /\n/, $input; say for @output; __DATA__ BSS <blah blah> SSID: <ssid> <blah blah> BSS <blah blah> SSID: <ssid2> <blah blah> BSS <blah blah> SSID: <ssid3> <blah blah>
Hope this helps!$ perl 1182702.pl <ssid> <ssid2> <ssid3>
|
|---|