On Oct 11, 2005, at 11:37, The Roopak Times wrote:

Hi All
As i was continuing with perl i created a program to churn out individual
directory names from a given path in windows.Here is the program:
 #use warnings;
#use strict;
 Print "Enter the path:";
my $dir=<STDIN>;
chomp($dir);
my @DIR=split ///, $dir;
print $DIR[0];
 but it throws an error "Search pattern not terminated"

The regexp for split should have the slash escaped (/\//), or m// delimiters could be changed (m{/}) to avoid backslashes, which do not contribute to readability (except for negative values of contribute :-).

Just for the record, the standard module File::Spec does that.

-- fxn

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