in reply to Removing digits until you see | in a string
You don't have to use a loop, either, if you're still not adverse to split. Just use a parallel assignment and throw away the other pieces.
my ( $index ) = split /\|/, $str; $data_hash{$index} = $str;
Update: Or to remove the digits from the string, you can do this:
my ( $index, @rest ) = split /\|/, $str; $data_hash{$index} = join '|', @rest;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removing digits until you see | in a string
by polettix (Vicar) on Jan 08, 2007 at 15:00 UTC |