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;
By the way, if you want a module that does this, just create it yourself and put it on CPAN. Make your world a better place, and possibly the worlds of others too.
- 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 |
In Section
Meditations