neversaint has asked for the wisdom of the Perl Monks concerning the following question:
my %charmap = ( A => '00', C => '01', G => '10', T => '11', ); my %digmap = ( '00' => "A", '01' => "C", '10' => "G", '11' => "T", ); my $string = $ARGV[0] || 'GATTACCCC'; $string =~ s/(.)/$charmap{$1}/ge; my $compressed = pack 'b*', $string; print "COMP: $compressed\n"; printf "%d bytes\n", length $compressed; my @data; push @data, $compressed; # now use vec() to get at the single # parts of $compressed my $decompressed = unpack 'b*', $compressed; $decompressed =~ s/(..)/$digmap{$1}/ge; print "$decompressed\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unpack Fail to Decompress String?
by BrowserUk (Patriarch) on Jan 09, 2009 at 16:26 UTC | |
|
Re: Unpack Fail to Decompress String?
by gone2015 (Deacon) on Jan 09, 2009 at 16:07 UTC | |
|
Re: Unpack Fail to Decompress String?
by setebos (Beadle) on Jan 09, 2009 at 16:29 UTC | |
|
Re: Unpack Fail to Decompress String?
by jethro (Monsignor) on Jan 09, 2009 at 16:37 UTC | |
by gone2015 (Deacon) on Jan 09, 2009 at 17:32 UTC | |
by BrowserUk (Patriarch) on Jan 10, 2009 at 10:56 UTC | |
by gone2015 (Deacon) on Jan 10, 2009 at 15:00 UTC | |
by samwyse (Scribe) on Jan 13, 2009 at 15:23 UTC | |
by BrowserUk (Patriarch) on Jan 13, 2009 at 15:32 UTC | |
by jethro (Monsignor) on Jan 09, 2009 at 18:46 UTC | |
by gone2015 (Deacon) on Jan 09, 2009 at 19:11 UTC | |
|
Re: Unpack Fail to Decompress String?
by diotalevi (Canon) on Jan 10, 2009 at 06:26 UTC |