On May 30, Rohesia Hamilton Metcalfe said: >#!/usr/local/bin/perl5 >use CGI qw(:standard); > >#make array of cgi-scripts: >@Scripts=("f-aaaa.cgi", "f-bbbbbb.cgi", "f-cccc.cgi", "f-dddd.cgi", >"f-eeeeee.cgi", "f-ffffff.cgi"); > ># pick one at random >srand; >$RandomScript = $Scripts[int(rand(@Scripts))]; > >#here's the non-working regex: >$ScriptName =~ s/$RandomScript/\w{3,}\b/;
Where did you get $ScriptName from? What is it supposed to hold? Also, you can't use a regex as the right-hand side of a s///. s/pattern/text/ is the way s/// is used. Perhaps you want to do: ($ScriptName) = $RandomScript =~ /(\w{3,}\b)/ That will match the regex /(\w{3,}\b)/ against the string in $RandomScript and assign the matched portion to $ScriptName. >$RandomScriptURL = "path/".$ScriptName.".htm"; This looks cleaner if you put the variable in the quoted string, instead of using the . operator: $RandomScriptURL = "path/$ScriptName.htm"; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]