in reply to Whatever happened to chomp?

As others have pointed out, it is perl DWYM but exactly how does it do that? Well if you look at perl internals, a scalar value can be a string, an integer or a double (or another scalar). By context, it determines which value to use. In a numeric context (==), it will use one of the numeric (integer or double), in a string context, (eq), the string value.

Check this out:

#!/usr/bin/perl use strict; use warnings; use Devel::Peek qw( Dump ); while (my $data = <DATA>) { chomp $data; print Dump( $data ); if ($data == 2){print "->got 2\n"} } print "Enter a 2\n"; my $input = <>; print Dump( $input ); if ($input == 2){print "->got 2\n"} __DATA__ 1 2 3 4

-derby