Question: $ cat > lab9c2.pl #!/usr/bin/perl -w open(FILE,$ARGV[0]) or die(Could not open the file $ARGV[0]); while ( $line = ) { ($loginID, $term, $ip) = split('
$ cat > lab9c2.pl
#!/usr/bin/perl -w
open(FILE,$ARGV[0]) or die("Could not open the file $ARGV[0]");
while ( $line =
($loginID, $term, $ip) = split(' ', $line);
($IPclass) = split('\.', $ip);
print "IP Class of $IPclass ";
}
close(FILE);
$
$ ./lab9c2.pl loginfile4lab9
IP Class of 162
IP Class of 10
IP Class of 10
IP Class of 50
IP Class of 107
IP Class of 10
IP Class of 73
IP Class of 73
IP Class of 10
IP Class of 50
$
Create a file signinhw10 as below:
last -wi | grep "Feb 22" | head -10 >signinhw10
Question:
Use lab9c2.pl introduced in Lab 9 and the code fragment that follows it as the basis to write a perl script, hw10a.pl, to compute and print the number of the class
B IP addresses
Here is how the program would be executed. The output from my program is also given. To improve clarity, I have deleted a couple of warnings I got.
$ ./hw10a.pl signinhw10
Number of Class B addresses is 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
