Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Head to numb to see it.....

by azatoth (Curate)
on Mar 08, 2001 at 22:17 UTC ( [id://63045]=note: print w/replies, xml ) Need Help??


in reply to Head to numb to see it.....

You have a space in it. Try :

$contact_me_count++;
instead.

HTH

Azatoth a.k.a Captain Whiplash

Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?

Replies are listed 'Best First'.
Re: Re: Head to numb to see it.....
by danger (Priest) on Mar 08, 2001 at 22:34 UTC

    FYI:It is perfectly legal to have a space between a variable and the ++ operator:

    my $count_variable = 0; $count_variable ++; $count_variable ++; print $count_variable; # prints: 2
      $s = 0; print $s ++ for 1..9;
      Will not increment. Apparently, it depends on the context, whether the whitespace matters.

      mkmcconn

      update: danger, I'm sure you must be right about the prototyping of print().

        There have to be exceptions to every rule :-). This was obviously not the problem with the present question though. And, I am inclined think this is perhaps a little bug:

        sub blah { print shift; } blah($s ++) for 1 .. 9; # works fine blah $s ++ for 1 .. 9; # syntax error print $s ++ for 1 .. 9; # syntax error print($s ++) for 1 .. 9; # syntax error

        The latter print() case is probably related to print()'s prototype for optionally accepting a filehandle).

      My first reaction was also that the space is wrong, but then tye corrected me in the CB so I did a bit of experimenting and found surprising (to me) results. Guess what this snippet will do:
      print $foo; print $foo ++; print $foo, $foo ++;

      --
      I'd like to be able to assign to an luser

        The second line is one of the strange cases with whitespace. This is due to the "indirect object" syntax where the first argument can be missing the separating comma to indicate that it is a file handle (in the case of print). Like I said, there are some interesting exceptions but for most things spacing doesn't matter.

                - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-16 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found