in reply to Re: Data Extraction Question
in thread Data Extraction Question
for /proj/home/me/asdf.p your code would correctly give: /proj/home/me/
but for asdf1.pl the result would be: asdf1.pl
another approach:
my $temp1 = "/proj/home/me/asdf.pl"; print my_dirname($temp1) ."\n"; $temp1 = "asdf1.pl"; print my_dirname($temp1) ."\n"; $temp1 = "/asdf1.pl"; print my_dirname($temp1) ."\n"; sub my_dirname { my ($dir) = $_[0] =~ m|^(.*/)|; return $dir; }
|
|---|