in reply to Re^2: New to Perl
in thread New to Perl

I respectfully disagree with you. It is not that he has given you a fish as much as he has built the pole for you. If it doesn't meet your standards, then that particular pole serves at least as a reference point for building your own.

I don't mind the style that much, though I would never say my $scalar="bleh"; before I said my($scalar) = "bleh";. But that's just me. I'm probably one of the few people left who puts parens around a single my arg. Of course, that's an OCD thing more than anything else. Anyway, I've never thought that getting nit-picky about another person's perl style was polite. If TIMTOWTDI and the interpreter doesn't ultimately care what method is chosen, I don't think it's up to you or anyone else to chastise another programmer for his style. It just seems un-perl to me.

I don't know if your intention was to be "politely rude" so to speak, but it comes off that way. What was wrong with simply saying "thanks for taking time out of your day to assist me" and disregarding the rest of what you felt you HAD to post. I could be interpreting that wrong, so I'm telling you how I heard it and giving you the opportunity to correct me.

I think this is the first node I've read where working code was frowned upon.

/renz.

UPDATE: Ugh. tall_man: bad example on my part. You're right. Humorously enough I finally gave up my desire to put parens before everything, some time after posting this, and for the very reason you have given. I just neglected to modify this post (mainly because I forgot about it). As of late I have labored greatly to conform to perldoc perlstyle as much as possible, though I have never preferred a 4-column indent to a 2-column indent, and I find it difficult not to cuddle my elses.

Replies are listed 'Best First'.
Re^4: New to Perl
by tall_man (Parson) on Jan 20, 2005 at 22:59 UTC
    I agree with what you say; providing some code in answer to a question is entirely appropriate most of the time.

    The nit I have is that you say there is no difference other than style between my $scalar="bleh"; and my($scalar) = "bleh";. There is a difference. The former uses scalar context and the latter uses list context. That can make a difference to the evaluation of an expression. For example:

    use strict; my $time1 = localtime(); my($time2) = localtime(); print "time1 is $time1\n"; print "time2 is $time2\n";

    The time2 line prints only the seconds value of the current time.