Perl

Stay ahead with the latest trends in custom software development. Explore how AI, automation, and cloud solutions are shaping the future of business technology.

Perl – Get the md5 hash for a file

Perl – Get the md5 hash for a file Get the MD5 hash for a file on the command line, using Digest::MD5 usage: ./md5sum.pl [filename] [-f] -f do not display filename [perl] use warnings; use strict; use Digest::MD5; sub md5sum { my $file = shift; my $digest = “”; eval{ open(FILE, $file) or die “Can’t […]
Continue Reading

Get HTTP Code Response – Perl

Get HTTP Code Response – Perl Pass the script many hosts and obtain the HTTP response codes for the pages. [bash] ./http_check.pl … [/bash] [perl] use LWP::UserAgent; print get_url($url); sub get_url ($) { my $url = shift; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => $url); my $res = $ua->request($req); return $res->code; } ##Some […]
Continue Reading