gaochong wrote: > But I think substr is better . > > my $str="0000000000000111"; > my $r=substr ($str,-3);
TimTowTdi (there is more than one way to do it): my $n = "0000000000000111"; my $last_3_chars = join('',(split(//,$n))[-3..-1]); print "$last_3_chars\n"; -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/