Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: question on declaring variables

by toolic (Bishop)
on Nov 22, 2018 at 12:03 UTC ( #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
Node Status?
node history
Node Type: note [id://1226177]
help
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2021-11-30 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?