in reply to Determining the regex for foo=bar
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %filehash; while (<DATA>) { if ( /(\w*) = (.+$)/ ) { $filehash{ $1 } = $2; } } print Dumper(\%filehash); __DATA__ foo1 = bar foo2 = bar bar
See perlre or perlretut for more info.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Determining the regex for foo=bar
by ack (Deacon) on Mar 12, 2010 at 02:20 UTC |