Mar 31, 2014, 12:48 PM
Post #1 of 2
Using Ping module in perl
Recently i've begun to program with perl, and i've stumbled accros two main issues which i couldnt solve myself:
1) First, i got a task to simulate the tracert command (from windows) in perl code. i've tried "cheating" by using qx(ping -i n) but ping doesnt give me the ms, which i need.
To the subject, i've been messing around abit with the Net::Ping module but i've had a hard time understanding how to use it. I wanna know if there's a way with this module to achieve what i want, which is pinging with a different ttl each time until i reach the destination address, and getting the ms of each ping.
2)Another problem i had is kinda weird. I've tried opening a file from a path recieved by user input. This is the code that i've written:
my $strPath = <>;
open(my $fh, "<", $strPath)
But it gives me an error when i run it (Invalid Parameter). I've checked the variable with print after inserting a value to it, i've tried also writting the path hard-copied in both the variable and the function and it worked fine. anyone has a clue what the issue is?