- or download this
use strict;
use warnings;
...
my ( $num, $text ) = unpack( 'A4xA*', $string );
print "[$num][$text]\n";
- or download this
[1234][this is the remaining string]
- or download this
use strict;
use warnings;
...
regex => sub { $string =~ m[(\d+)\s+(.*)$] },
split => sub { split( /(\d+)\s+/, $string, 2 ) },
} );
- or download this
Rate split regex unpack
split 789472/s -- -44% -70%
regex 1422218/s 80% -- -45%
unpack 2594984/s 229% 82% --