in reply to Re: Re: Perl Programming guidlines/rules
in thread Perl Programming guidelines/rules

It's harder to screw up when adding variables. I've done my $this = shift then tried to change it to my ($this,$x) = shift if you start with my ($this) = @_; then my ($this,$my,$something,$asdfjkksaldf) = @_; will be less error prone
  • Comment on Re: Re: Re: Perl Programming guidlines/rules

Replies are listed 'Best First'.
Re^4: Perl Programming guidlines/rules
by particle (Vicar) on Nov 22, 2002 at 21:52 UTC

    unless, of course, you add your variables by

    ## start with: my $foo = shift; ## adding $bar yields: my $foo = shift; my $bar = shift;

    it's a matter of style. if you're changing your style, it's safer to rewrite the code from scratch than to modify in place -- even (or especially) if it's only one statement.

    ~Particle *accelerates*

Re: Re: Re: Re: Perl Programming guidlines/rules
by hardburn (Abbot) on Nov 22, 2002 at 22:06 UTC

    Huh? I thought it was rather clear from the documentation that shift doesn't care if you're using list context. It just always takes the first element off an array and returns it. What made you think otherwise?

    my $this = shift; my $x = shift; ...