[EMAIL PROTECTED] schreef:

> Anyways, this how my subroutine now looks:
>
> sub xyz {
>     $x = $_[0];

Make that

      my $x = $_[0] ;

Alternatives:

      my $x = shift ;

      my ($x) = @_ ;

(that last one if you only expect 1 parameter)


Put

  use strict ;
  use warnings ;

on top of every script, unless you have a real reason not to.


>     chop $x;

Could be combined:

  chop (my $x = shift) ;


>     ... do stuff with $x
> }


> It was chop and not chomp that I need, I'm removing the last "/" on a
> directory path, not newlines

Are you sure that the '/' is always there?

  chop $x if substr($x, -1) eq '/' ;

And with Windows, you probably wouldn't want to chop 'C:/'.

-- 
Affijn, Ruud

"Gewoon is een tijger."



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to