in reply to How to list all possible variations ?

Something like this?

#! perl -slw use strict; my @logfiles=("access.html","access_log","log.txt","log.html"); my @logfolders=("accesslogdir","logs"); my @cgifolders=("cgi","cgi-bin","scripts"); my @cgifiles=("script.pl","test.pl","tools.pl"); my $baseurl="http://www.testurl.com"; for my $folder ( @logfolders, @cgifolders, '' ) { for my $file (@logfiles) { (my $combURL = "$baseurl/$folder/$file") =~ tr[/][]s; print $combURL; } } __END__ C:\test>227227 http:/www.testurl.com/accesslogdir/access.html http:/www.testurl.com/accesslogdir/access_log http:/www.testurl.com/accesslogdir/log.txt http:/www.testurl.com/accesslogdir/log.html http:/www.testurl.com/logs/access.html http:/www.testurl.com/logs/access_log http:/www.testurl.com/logs/log.txt http:/www.testurl.com/logs/log.html http:/www.testurl.com/cgi/access.html http:/www.testurl.com/cgi/access_log http:/www.testurl.com/cgi/log.txt http:/www.testurl.com/cgi/log.html http:/www.testurl.com/cgi-bin/access.html http:/www.testurl.com/cgi-bin/access_log http:/www.testurl.com/cgi-bin/log.txt http:/www.testurl.com/cgi-bin/log.html http:/www.testurl.com/scripts/access.html http:/www.testurl.com/scripts/access_log http:/www.testurl.com/scripts/log.txt http:/www.testurl.com/scripts/log.html http:/www.testurl.com/access.html http:/www.testurl.com/access_log http:/www.testurl.com/log.txt http:/www.testurl.com/log.html C:\test>


Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Replies are listed 'Best First'.
Re: Re: How to list all possible variations ?
by Anonymous Monk on Jan 15, 2003 at 22:24 UTC
    works excellent browseruk except that it is stripping one of the fwd slashes from the baseurl i.e. it is turning http://www.testurl.com into http:/www.testurl.com

      I completely missed that. Substitute these two lines.

      (my $combURL = "/$folder/$file") =~ tr[/][]s; print "$baseurl$combURL";

      Examine what is said, not who speaks.

      The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.