D
D
Dmitry2014-03-21 20:12:53
Perl
Dmitry, 2014-03-21 20:12:53

Foreach in Perl - is it possible to do this?

Hello, the question arose, how can I implement the passage through the cycle and then through the next cycle? I don't know Perl at all, so any help would be greatly appreciated!

my $start_year=2013;
my $stop_year=2000;
my $interval=100;

foreach (reverse($stop_year..$start_year)){
 `wget -q -O /dev/null "http://site.ru/get_programm.php\?year=$_\&auto=Lada"`;
sleep $interval;
}
foreach (reverse($stop_year..$start_year)){
 `wget -q -O /dev/null "http://site.ru/get_programm.php\?year=$_\&auto=Zaz"`;
sleep $interval;
}
foreach (reverse($stop_year..$start_year)){
 `wget -q -O /dev/null "http://site.ru/get_programm.php\?year=$_\&auto=Audi"`;
sleep $interval;
}

Can this be done and is it correct?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gendalph, 2014-03-22
@Gendalph

Should work.
PS: sleep takes an argument in seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question