On Thu, Jun 11, 2009 at 12:10 AM, raphael() <raphael.j...@gmail.com> wrote:
> Is there a better way to write this without modules? > OR is it just too simple & just fine written this way? > So if I understand correctly, you're trying to get files named like getthisfile01.txt through getthisfile10.txt, is that right? If so: Here's one way to do it: #!/usr/bin/perl use strict;use warnings; foreach my $num (1..10) { $num =~ s/^([1-9])$/0$1/; system('wget', "http://abc.com/texts/files/getthisfile_$num.txt");} Here's another: #!/usr/bin/perl use strict;use warnings; foreach my $num (qw(01 02 03 04 05 06 07 08 09 10)) { system('wget', "http://abc.com/texts/files/getthisfile_$num.txt");} And here's another: #!/usr/bin/perl use strict;use warnings; foreach my $num (1..10) { system('wget', 'http://abc.com/texts/files/getthisfile_' . sprintf("%02d", $num)) . '.txt';} John