#!/usr/bin/perl use strict; use warnings; die "No filename given.\n" unless @ARGV; die "Too many args.\n" unless @ARGV == 1; my ($filename) = @ARGV; open my $fh, "<", $filename or die "Couldn't open $filename for reading: $!"; my $count = 0; while ( my $line = <$fh> ) { $count++ if $line =~ /\S/; # something other than whitespace } close $fh; if ( $count == 0 ) { print "up to date\n"; } else { print "$count available updates\n"; }