> I tried to do this with split(), but it's not working good at all....
> 
> The string:
> interface=something very long with spaces and all
> mac-address=00:02:6F:36:2D:31 ap=no wds=no rx-rate=11Mbps tx-rate=11Mbps
> packets=12623,18377 bytes=10829240,2009327 frames=12623,18377
> (the above is one line, wrapped for email).
> 
> I need to grab the values for all the options....

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;

my $data = 'your=data goes=here';
my %opts = ();
$opts{$1} = $2 while $data =~ /([^= ]+)=([^=]+)(?= [\w-]+=)/g;
print Dumper(\%opts);

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to