#!/usr/bin/perl -w ######################################## # Modules use strict; # parameter Definition before use them use Net::TFTP; use threads; use threads::shared; ####################################### # Paramet Definition my $ct=20; # counter parameter my $tftp = Net::TFTP->new("IP-des-Servers", BlockSize => 1024); ########################### # main programm system("clear"); print "Starting main program\n"; my @threads; for ( my $count = 1; $count <= $ct; $count++) { my $t = threads->new(\&sub1, $count); push(@threads,$t); } foreach (@threads) { my $num = $_->join; print "Download ready $num\n"; } print "End of main program\n"; sub sub1 { my $num = shift; $tftp->get("RemoteFile", "LocalFile"); print "Download Nr.$num started\n"; # sleep $num; # print "done with thread $num\n"; return $num; }