On Oct 5, [EMAIL PROTECTED] said:

I would like to split up a string like this

        my $cd = $arguments;
        @dirs = split(///,$cd); #Split $cd when there occurs a backslash

but it doesn't seem to work. I guess /// must be rewritten in some way,
but how?

'/' is a FORWARD slash. '\' is a BACK slash. Here are two solutions to your problem:

  my @dirs = split /\//, $cd;  # splitting on forward slashes
  my @dirs = split '/', $cd;   # same thing, less ugly

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
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