in reply to Merge 2 strings like a zip
hehehe
#!/usr/bin/perl # http://perlmonks.org/?node_id=1133857 use warnings; use strict; print zip("ABCDEFGHIJ", "abcde"), "\n"; sub zip { my ($str1, $str2) = @_; my $len = length $str2; pack("(ax)$len (a)*", split //, $str1) | pack "(xa)$len", split //, +$str2 }
|
|---|