Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Use of uninitialized value in substitution (s///)

by BrowserUk (Pope)
on Oct 06, 2011 at 23:57 UTC ( #930089=note: print w/ replies, xml ) Need Help??


in reply to Use of uninitialized value in substitution (s///)

Line 192 is "$ACETmpltDir = ~s/$ACEEnvironment//g;".

That should be $ACETmpltDir =~ s/$ACEEnvironment//g;. Pay careful attention to the spacing around =~.

What you have at the moment is trying to apply the substitution to $_; then apply logical not (*) bitwise negation (~) to the numeric result of that:

$_='aaaaa'; print s[a][]g;; 5 $_='aaaaa'; print ~s[a][]g;; 18446744073709551610

and finally assign (=) that to $ACETmpltDir, but it falls at the first hurdle because $_ is undefined.

(*)Corrected. Thanks to AnomalousMonk


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Use of uninitialized value in substitution (s///)
Select or Download Code
Re^2: Use of uninitialized value in substitution (s///)
by AvanTTix (Initiate) on Oct 07, 2011 at 00:02 UTC

    THANK YOU!

    I totally overlooked this part of the syntax, even from the examples I looked up online.

      Happened to me just a few hours ago :)

      That really ought to be a warning, I can't imagine a use case where you want the bitwise negation of the number of substitutions  $foo = ~s/// or matches  $foo = ~m//

      every time I've encountered this in the past, its always been a mistake

      warnings should issue a specific warning

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-12-29 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (186 votes), past polls