I notice you've been advised (multiple times) to just remove the offending line. I suspect, though, that you may get similar messages with the other two modules.
When there's a task like yours, it's good to first see if there's a module for it (or some components of it), as modules can help avoid 'reinventing the wheel,' are often mature and well-tested, and can reduce development time and programmatic errors. Some, however, may have to work with the Perl environment as is, with no option to install modules.
Given the above, see the modified script below (that's not a subroutine):
use strict; use warnings; my ( $file, $loop, %seen ) = 'junk.txt'; open my $fh1, '<', $file or die "Unable to open $file: $!"; while ( my $fileName = <$fh1> ) { chomp $fileName; print "The packet traversed this path in $fileName:\n"; open my $fh2, '<', $fileName or die "Unable to open $fileName: $!" +; while ( my $fileLine = <$fh2> ) { $fileLine =~ /(\d+\.\d+\.\d+\.\d+)/ or next; $loop++ if ++$seen{$1} > 1; print "$1\n"; } close $fh2; print "\n"; } close $fh1; print "** Routing Loop Detected **\n" if $loop;
In reply to Re^3: No such file or directory at R_loop2.pl line 19.
by Kenosis
in thread No such file or directory at R_loop2.pl line 19.
by zakishah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |