Dartanion has asked for the wisdom of the Perl Monks concerning the following question:

I have a varible that contians the following information
$filename='K:\Piba0001\53\22136603.soa'
I want to split the variable on the '\' character. I have tried
@STMT = split (/\/,$filename) ;
but that doesn't seem to work. Can anyone help me out.

Title edit by tye

Replies are listed 'Best First'.
Re: How do i do the following
by dda (Friar) on Aug 09, 2002 at 12:30 UTC
    You should escape '\' symbol with '\':

    @STMT = split (/\\/,$filename);

    --dda

Re: How do i do the following
by virtualsue (Vicar) on Aug 09, 2002 at 12:31 UTC

    You are trying to split based on the regex 'escape' character, so you need to escape it. :-)

    @stuff = split /\\/, $filename;