#!/usr/bin/perl my @a = (); while ($line = <>) { while (@a) { pop @a; } homp $line; while ($line =~ m/^([\d]+)[\D]/) { push @a, $1; $line =~ s/($1).//; } push @a, $line; for ($x = 0; $x < $#a; $x++) { print chr($a[$x]); } print chr($a[$x]), "\n"; }