baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
so the problem is the folloving:
it is probably something stupid , as i am quite tired but why isn't the second case being evaluated (or it is but why is it returning 0 )perl -le '$t="a/b"; if ($t =~/^(.*?)\//){$z=$1}elsif($t=~/\/(.*)/){$z= + $1} print $z' #prints a perl -le '$t="/b"; if ($t =~/^(.*?)\//){$z=$1}elsif($t=~/\/(.*)/){$z= +$1} print $z' #prints nothing
thnx
baxy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Basic but stupid problem i cannot wrap my head around
by Corion (Patriarch) on Aug 06, 2020 at 09:06 UTC | |
|
Re: Basic but stupid problem i cannot wrap my head around
by jeffenstein (Hermit) on Aug 06, 2020 at 16:50 UTC | |
|
Re: Basic but stupid problem i cannot wrap my head around (oneliners)
by Anonymous Monk on Aug 06, 2020 at 10:17 UTC | |
|
Re: Basic but stupid problem i cannot wrap my head around
by perlfan (Parson) on Aug 11, 2020 at 01:33 UTC |