Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Stupid mistakes I repeatedly make

by guha (Priest)
on Mar 30, 2005 at 20:22 UTC ( #443600=note: print w/ replies, xml ) Need Help??


in reply to Stupid mistakes I repeatedly make

My most irritating mistake concerns the use of x, the repetition operator.

my $multiple_Zs = 7 x 'Z'; ##Wrong
instead of
my $multiple_Zs = 'Z' x 7; ##Correct

I'm not sure but I guess this has something to do with that English is not my first language. I think the natives read it as "Z times 7" and then is DWIMs. In Swedish it spoken the other way around. But all in all, this is one of only a few cases where Perl NDWIM.


Comment on Re: Stupid mistakes I repeatedly make
Select or Download Code
Re^2: Stupid mistakes I repeatedly make
by ihb (Deacon) on Mar 30, 2005 at 21:52 UTC

    In Swedish it spoken the other way around.

    I disagree, and being swedish I can do that. :-) Maybe you think like that, but not everyone does. "Times" in swedish, "gånger", is just as commutative as "times". A hypothesis is that one may think like that because that's how one often does it when being taught algebra in school: 7a + 3b = 2c.

    If you don't look at it like multiplication but rather as "repeated ... times" it perhaps would be easier to remember.

    ihb

    See perltoc if you don't know which perldoc to read!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-09-24 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (243 votes), past polls