Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Basic but stupid problem i cannot wrap my head around

by Corion (Patriarch)
on Aug 06, 2020 at 09:06 UTC ( [id://11120411]=note: print w/replies, xml ) Need Help??


in reply to Basic but stupid problem i cannot wrap my head around

In your first input string, there is an a, this gets matched and then assigned to $z (and printed).

In your second input string, there is an empty string before the /, and no a. This gets matched and then assigned to $z (and printed).

Maybe you don't want the stuff in front of the slash to be empty?

perl -le '$t="/b"; if ($t =~/^(+*?)\//){$z=$1}elsif($t=~/\/(.*)/){$z=$ +1} print $z'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120411]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-16 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found