in reply to Re: beginner syntax question
in thread beginner syntax question
#!/usr/bin/perl -w # IP ranger # If you're on 5.6.0 or higher, add the following two lines # and remove the -w #use 5.6.0; use strict; #use warnings; open(IPFILE,"<iplist.txt"); # open readonly || die "Could not open iplist.txt:$! \n"; while (<IPFILE>) { chomp; my ($stip,$edip) = split ':', $_, 2; # split(/:/); print "$stip\n"; print "$edip\n"; my @openip = split '.', $stip; # split(/\./,$stip); my $count = @openip; print "$count\n"; # you can avoid the creation of the $count # variable and use the following statement # print scalar(@openip), "\n"; # for ($i = 0; $i <= 4; $i++) { # print "@srtip\n"; # }; }; close(IPFILE);
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|