Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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


    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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2015-11-26 01:29 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (695 votes), past polls