Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a variable $location whose value is data,I want to match another variable $file with /$location/ making the later "/" optional,meaning match $file to /data/(later "/" is optional),how can I make the later "front slash(/)" optional?If it is present it should match,if it not present ignore
$location="data"; next if $file !~ /$location[/]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Making the later front slash "/" optional
by davido (Cardinal) on May 03, 2011 at 07:24 UTC | |
by CountZero (Bishop) on May 03, 2011 at 10:12 UTC | |
|
Re: Making the later front slash "/" optional
by Ratazong (Monsignor) on May 03, 2011 at 07:09 UTC | |
by davido (Cardinal) on May 03, 2011 at 07:38 UTC | |
|
Re: Making the later front slash "/" optional
by anonymized user 468275 (Curate) on May 03, 2011 at 09:09 UTC | |
|
Re: Making the later front slash "/" optional
by 7stud (Deacon) on May 03, 2011 at 17:34 UTC |