Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with "for" loop in perl

Status
Not open for further replies.

newbie1006

Technical User
Jun 10, 2011
9
0
0
US
if ($string =~ /(.*?)u(.*)/s)
{

my $pre = $1;
my $post = $2;

for my $index(0..4)
{
print "$pre$index$post\n";
push(@register_list, "$pre$index$post");
}

}

is there a way to make it print like 0,1,2,3,4 and not just 1,2,3,4??
 
If I use
Code:
for my $index(0..4) {
    print "$index\n";
    }

I get
0
1
2
3
4

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top