#!/usr/bin/perl use strict; use warnings; $ARGV = shift; open (DOMAIN, $ARGV) || die "Couldn't open $ARGV: $!\n"; foreach my $domain () {chomp $domain; my $output = qx`whois $domain`; my $expire = $output =~ /(.*)xpir(.*)/; #Wanna match all sentences that say #expiration or expires print "$domain $expire"; #printing for debugging, will write to file later. } close(DOMAIN);