Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: use strict won't require explicit name for all variables?

by dws (Chancellor)
on Feb 28, 2002 at 10:18 UTC ( #148179=note: print w/replies, xml ) Need Help??

in reply to use strict won't require explicit name for all variables?

The question is: Why doesn't perl require explicit package names for $a and $b?

Change $a and $b to $x and $y, and you'll get the error. This is probably an artifact of the semi-special nature $a and $b in sort blocks.

  • Comment on Re: use strict won't require explicit name for all variables?

Replies are listed 'Best First'.
Re: Re: use strict won't require explicit name for all variables?
by Biker (Priest) on Feb 28, 2002 at 10:25 UTC

    Thanks go out to both dws and Matts. I've never been using the sort routines in Perl. And I never name my variables like $a, $b or $c either. So I haven't been in this trouble.

    I hope that perl 6 will do something to avoid this 'problem'. In the mean time, I'll tell my co-worker to avoid those names. ;-)

    Everything will go worng!

      Well, its not really a problem, so im not sure Perl 6 will do much about it.


      Yves / DeMerphq
      When to use Prototypes?

        Problem or not problem. I consider the usage of certain variable names as 'special' variables a problem.
        Will $nbr be used as a special variable one day? Or what about $i if we stick to one character names? (Wonder how many scripts would be broken by that last one.)

        OK, so $a and $b were both there before me, but how am I to know? How am I to know that I need to read up on sort to know that they exist?

        I admit that there are $_ and many other 'special' variables and I use them on a daily basis. But they look different and I instinctively don't use those names as my working variables. With $a and $b I have to explicitly be aware of their special behavior/existence or else devine their existence which is very far from intuitive.

        But that is, of course, just an opinion. ;-)

        Everything will go worng!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://148179]
[erix]: I should lose some weight although I keep telling myself that I'm doing extra training by lugging it along
[erix]: I saw a common kingfisher and a couple of bullfinches
[erix]: bullfinch ( a male and a female )
erix learned the word 'portaging' not so long ago (from vikings lugging their ships from one river-system to another)
[choroba]: my best run so far
[erix]: I think they build a portaging installation for yachts here not so long ago - lemme google it
[erix]: choroba ah, you should have sprinted 7 s off that :)
[erix]: (but then there's always a next (im)possible goal)
Corion avoids running by starting on time
[choroba]: my phone showed me 1 hour 10 km which was my goal, it changed a bit after uploading to the website

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-05-24 12:46 GMT
Find Nodes?
    Voting Booth?