Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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
Replies are listed 'Best First'.
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 drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2015-07-30 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls