in reply to Regex with -
An alternate way of doing this, rather than using split, would be to use matching parens in the regular expression that you already have:% test.pl ca foo->bar $VAR1 = { 'foo' => 'bar' };
This would work if your commands are always 2 characters long, and if they always have the same format with the "->".if ($in =~ /^(\w{2})\s+(\w+)->(\w+)$/) { my($command, $key, $value) = ($1, $2, $3); $aliases{$key} = $value; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Regex with -
by elusion (Curate) on Jul 21, 2000 at 01:27 UTC |