Skip to content

Instantly share code, notes, and snippets.

@dataich
Created December 4, 2009 12:55
Show Gist options
  • Save dataich/249009 to your computer and use it in GitHub Desktop.
Save dataich/249009 to your computer and use it in GitHub Desktop.
$str = "12345123456712"; #固定長テキスト
@lengths = (5,7,2); #分割する長さの指定
$format = ''; #フォーマット
#フォーマットの作成
foreach $length(@lengths) {
$format .= "A$length";
}
@outs = unpack $format, $str;
foreach $out(@outs) {
print "$out ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment