John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
doesn't work. Ought it? As a normal if statement, it will attempt to do the replacement and return true if it matched, and if it didn't match, it doesn't do the replacement and also returns false.when ( s{^cpan://}{http://search.cpan.org/search?query=}p) {
As an 'if' statement, it would also implicitly work against $_.
Even adding the $_ =~ in explicitly doesn't work! It still tells me "isn't numeric". I have to say when ( !! ($_ =~ s ... to get it to swallow it, which is totally insane.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "when" and replacements
by ikegami (Patriarch) on May 07, 2011 at 06:33 UTC | |
by John M. Dlugosz (Monsignor) on May 07, 2011 at 07:06 UTC | |
by ikegami (Patriarch) on May 08, 2011 at 06:24 UTC | |
by John M. Dlugosz (Monsignor) on May 09, 2011 at 22:05 UTC | |
by ikegami (Patriarch) on May 09, 2011 at 23:16 UTC | |
|
Re: "when" and replacements
by CountZero (Bishop) on May 07, 2011 at 06:50 UTC | |
by John M. Dlugosz (Monsignor) on May 07, 2011 at 07:08 UTC | |
by CountZero (Bishop) on May 07, 2011 at 07:21 UTC | |
by John M. Dlugosz (Monsignor) on May 07, 2011 at 08:53 UTC | |
by LanX (Saint) on May 07, 2011 at 09:01 UTC | |
|
Re: "when" and replacements
by JavaFan (Canon) on May 07, 2011 at 07:46 UTC | |
by John M. Dlugosz (Monsignor) on May 07, 2011 at 09:02 UTC | |
by LanX (Saint) on May 07, 2011 at 09:27 UTC | |
by JavaFan (Canon) on May 07, 2011 at 10:55 UTC | |
by LanX (Saint) on May 07, 2011 at 11:25 UTC | |
by JavaFan (Canon) on May 07, 2011 at 12:01 UTC | |
| |
by John M. Dlugosz (Monsignor) on May 08, 2011 at 01:40 UTC | |
by JavaFan (Canon) on May 08, 2011 at 11:09 UTC | |
by LanX (Saint) on May 08, 2011 at 12:58 UTC |