Tag Archives: perl
Get alexa rank from alexa.com with perl.
This is just a little code snippet to return the alexa rank of a given site from http://alexa.com. The script should be easily adaptable to whatever you’re using it for, but let me know if you have any questions. #!/usr/bin/perl use strict; use LWP::Simple; use URI::URL; my $need_alexa_rank = $ARGV[0]; my $url = url("http://alexa.com/siteinfo/$need_alexa_rank"); my [...]
Check if file exists with perl.
Take a command line filename and check if the file exists. I think this is a bashy way of doing this, but its useful nonetheless: #!/usr/bin/perl use strict; die "usage: exist.pl file\n" unless defined($ARGV[0]); if (-e $ARGV[0]) { print "File exists!\n"; } else { print "File does not exist!\n"; } The opposite can also [...]
List disks on linux server for nagios.