SO i've kinda got though the first part now I need to ping from the first entered address through to the last entered address. here is the code i have so far
#A script to identify any device that is using factory settings within + the network ie default username and password. #The script is designed so that the user (Network Admin) enters in bot +h the start and end of the IP range of the network and a address list + #is then generated and logged.After logging the range of the network e +ach address will be pinged to detect if a device is located on that a +ddress #A second log file is created and the active address are then listed. +On a second round the script will grab any information the device is #showing and log this as well. The known device locatations are then t +o be cross referenced with a default list of device usernames and pas +swords. #If a device is able to be access with one of the defaults it will be +listed as TRUE in the log and the device will be identified as well. #Once complete an email will be sent to the admin containing the three + log files. #!/usr/bin/perl -w use strict; use warnings; use diagnostics; #Enter and Validate IP Address Range. use Data::Validate::IP qw(is_ipv4 is_ipv6); print "Enter IP Range Starting Address:"; my $answera = <STDIN>; if(is_ipv4($answera)){ print "Looks like an ipv4 address\n"; } else { print "Not an ipv4 address\n"; print "\nReEnter Address:"; my $answera = <STDIN>; } print "\nEnter IP Range Finishing Address:"; my $answerb = <STDIN>; if(is_ipv4($answerb)){ print "Looks like an ipv4 address"; } else { print "Not an ipv4 address\n"; print "\nReEnter Address:\n"; my $answerb = <STDIN>; } use Net::IP; use NetAddr::IP; my $ipa = new NetAddr::IP->new($answera); my $ipb = new NetAddr::IP->new($answerb); print "\nNetwork starts at $ipa and finshes at $ipb\n"; #Create a log file with the active IP address and corresponding device + names. open (MYLOG, '>>addressrange.txt'); print MYLOG "Network starts at $ipa and finshes at $ipb"; print MYLOG "$ipa +(1)"; close (MYLOG); #Create range between the two entered IP address' #Ping address' within the range. Log these in the log file. use Net::Ping; my $p = Net::Ping->new(); $p->ping($ipa [,5]); print "$ipa ia alive.\n" if $p->ping($ipa); $p->close();
I've read the syntax and diagnostics but it's not making any sense sorry.

In reply to Re^2: New to Perl by NastyPenguin
in thread New to Perl by NastyPenguin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.