wizard341 has asked for the wisdom of the Perl Monks concerning the following question:
I cant understand exactly what the first 2 statements do, ive been told the first statement will match anything, because its using the .* operator, but i dont know. If anyone would be so kind as to tell me what the first to pattern matching strings are looking for, i think that would lessen my headache and my extreme hatred for this old programmer!if ($Path =~ m{^(.*)\/([^\/]*)}) { $Dir = $1; $File = $2; $Ext=$3; } else { $File = $Path; } if ($File =~ m{^(.*)\.([^\.]*)}) { $File = $1; $Dot = "."; $Ext = $2; } else { $Dot = ""; $Ext = ""; } if (-d "/$Dir/$File") { $Dir .= "/$File"; $File = ""; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl string matching
by broquaint (Abbot) on Oct 28, 2002 at 17:00 UTC | |
|
Re: Perl string matching
by Molt (Chaplain) on Oct 28, 2002 at 17:06 UTC | |
|
Re: Perl string matching
by roik (Scribe) on Oct 28, 2002 at 17:12 UTC | |
|
Re: Perl string matching
by fruiture (Curate) on Oct 28, 2002 at 17:09 UTC |