in reply to Possible unpack modification (or module)
Completely untested, but I just HAD to mention "fun"pack.sub funpack { my ($template, $source) = @_; my @fields; push @fields, $2 while $template =~ s/(\D\d+)(\S+)/$1/; my $hash = {}; @$hash{@fields} = unpack $template, $source; return $hash } my $data = funpack 'A20name A1sex A3age A8salary A12sign', $foo;
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Possible unpack modification (or module)
by Aristotle (Chancellor) on Sep 30, 2002 at 16:30 UTC |