babel17 has asked for the wisdom of the Perl Monks concerning the following question:
Nevermind, total brain fart. was getting the sense of the Trinary wrong
I would have thought that the return value of a successful chomp would be interpreted as "true", but it appears that it returns false. Or maybe I'm just fignerent.
example.
I'm joining a list of newline separated strings from STDIN with '|' so that I can use them as input to a regex.
but it don't work. To get it to function correctly I have to reverse the sense of the trinary operator.my $names=join("|",map {chomp $_ ?"":$_} <STDIN>);
Anyone care to enlighten me?my $names=join("|",map {chomp $_ ?$_:""} <STDIN>);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: return value of chomp is false?
by chromatic (Archbishop) on Sep 29, 2009 at 01:50 UTC | |
by babel17 (Acolyte) on Sep 29, 2009 at 16:50 UTC | |
by ikegami (Patriarch) on Sep 29, 2009 at 17:57 UTC | |
Re: return value of chomp is false?
by toolic (Bishop) on Sep 29, 2009 at 01:37 UTC | |
by babel17 (Acolyte) on Sep 29, 2009 at 16:56 UTC | |
by toolic (Bishop) on Sep 29, 2009 at 17:28 UTC |
Back to
Seekers of Perl Wisdom