#!/usr/bin/perl use strict; use warnings; my $str = '2004'; $str =~ /(.{4})/g; my $y = $1; $str =~ /(.{2})/g; my $m = $1; $str =~ /(.{2})/g; my $d = $1; print "$y-$m-$d\n"; __END__ 2004-2004-20
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
In reply to Re^2: Splitting up a string by lengths
by polettix
in thread Splitting up a string by lengths
by cosmicperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |