mdegges has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for any help!use File::Basename; #list of filenames to normalize my @index_file_names=qw(index.html index.htm index.php index.asp index +.cgi); sub normalize_url { my $old_url = $_[0]; chomp($old_url); #saves name at the end my $filename=basename($old_url); if (grep {$_ eq $filename} @index_file_names) { #saves the directory part my $normalized_url=dirname($old_url); $normalized_url; }else{ #don't need to normalize url $old_url; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is there a way around grep?
by toolic (Bishop) on Oct 11, 2011 at 01:20 UTC | |
|
Re: Is there a way around grep?
by BrowserUk (Patriarch) on Oct 11, 2011 at 03:01 UTC | |
|
Re: Is there a way around grep?
by ikegami (Patriarch) on Oct 11, 2011 at 02:35 UTC | |
by suaveant (Parson) on Oct 11, 2011 at 15:53 UTC | |
by AnomalousMonk (Archbishop) on Oct 11, 2011 at 22:42 UTC | |
by ikegami (Patriarch) on Oct 15, 2011 at 08:26 UTC |