in reply to return value of chomp is false?
I would have thought that the return value of a successful chomp would be interpreted as "true", but it appears that it returns false.According to the documentation for chomp:
It returns the total number of characters removed from all its arguments.If there is no newline, for example, it returns 0; if there is a newline, it returns 1.
So, chomp $_ will return 1, which is true, which causes the ternary operator to return the 'true' result. In your non-working case, it returns the empty string. In your working case, it returns the $_ without the newline.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: return value of chomp is false?
by babel17 (Acolyte) on Sep 29, 2009 at 16:56 UTC | |
by toolic (Bishop) on Sep 29, 2009 at 17:28 UTC |