$ cat 938362.pl #!/usr/bin/perl use strict; use warnings; use Scalar::Util qw(looks_like_number); my $t; while ($t = ) { $t=~s/\s+$//; print "\ninput = '$t'\n"; if (looks_like_number($t)) { print "looks numeric\n"; if ($t == 0) { print "Gotta have somethin' if ya wanna be with me\n"; } else { print "There are $t ways to leave your lover\n"; } } else { print "non-numeric\n"; if ($t eq "Godzilla") { print "Oh, no! There goes Tokyo, go go $t!\n"; } elsif ($t =~ /horse/i) { print "A horse is a horse of course, of course\n"; } else { print "insert song lyric here...\n"; } } } __DATA__ Godzilla 50 A horse of a different color 0 zebra $ perl 938362.pl input = 'Godzilla' non-numeric Oh, no! There goes Tokyo, go go Godzilla! input = '50' looks numeric There are 50 ways to leave your lover input = 'A horse of a different color' non-numeric A horse is a horse of course, of course input = '0' looks numeric Gotta have somethin' if ya wanna be with me input = 'zebra' non-numeric insert song lyric here...