How about:

use strict;
use warnings;
foreach my $i(1..10){$i="0" . $i if length($i)==1;print "$i\n";}

-----Original Message-----
From: lina [mailto:lina.lastn...@gmail.com] 
Sent: Monday, June 11, 2012 8:49 AM
To: beginners@perl.org
Subject: how to get a sequence of 01 02 ..

Hi,


$  for i in `seq -f '%02g' 1 10` ; do echo $i ; done
01
02
03
04
05
06
07
08
09
10

I wonder how can I get something like above in the perl.

Thanks ahead for your suggestions,

Best regards,

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to