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

Re: question on declaring variables

by toolic (Bishop)
on Nov 22, 2018 at 12:03 UTC ( [id://1226177]=note: print w/replies, xml ) Need Help??


in reply to question on declaring variables

Yes, the declaration is the same for both files, but $a is a special variable, whereas $x and $y are not. You get the error messages because you correctly use strict:
Because of their special use by sort(), the variables $a and $b are exempted from this check.
You should avoid using $a and $b because they are special for the sort function. As the helpful message reports, you need to declare x and y with my.

Replies are listed 'Best First'.
Re^2: question on declaring variables
by badbanana (Novice) on Nov 22, 2018 at 12:15 UTC
    oh i see. thanks, got it!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found