Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Variable assignment confusion

by kilinrax (Deacon)
on Dec 15, 2003 at 19:34 UTC ( #314886=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Variable assignment confusion
in thread Variable assignment confusion

Please don't assume that someone else is right just because they are more experienced than you; always try (as you have done :) to get an explanation. Cargo cultism often stems from unquestioningly assuming that unusually-written code is that way for a reason.

As to your inquiry, '\z' matches the very end of the string; whereas '$' matches the end, or just before a newline at the end of a string.
This doesn't make any difference in your case; so I'd use '$' to avoid confusion.

If you're curious; '\z' becomes much more useful when you switch on the '/m' (multi-line) flag on a regex to allow '$' to match before any newlines in the string. Have a look at perldoc perlre or Mastering Regular Expressions for more details.

  • Comment on Re: Re: Re: Variable assignment confusion

Replies are listed 'Best First'.
Re: Re: Re: Re: Variable assignment confusion
by ysth (Canon) on Dec 15, 2003 at 20:05 UTC
    This doesn't make any difference in your case; so I'd use '$' to avoid confusion.
    IMO, using $ causes confusion.
  • To those who know the difference between \z and $, it confuses what the code does
  • To those who don't, it perpetuates their confusion.

    Note that \Z (capital) is equivalent to (?-m:$) (i.e. does what $ does not under //m) even when //m is on. \z (lowercase) always is just the end of the string.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-01-22 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (63 votes). Check out past polls.

    Notices?