while (<>) { chomp; # All do the same thing print "$_ is a number" unless tr/0-9//c; print "$_ is a number" unless /\D/; print "$_ is a number" if /^\d+$/; }