If you use CGI.pm, then there's no need to get messy with regexps: the param and (self_)url function/methods are all you need ...
use CGI qw/ :standard /; print header; # save requested slice my $slice = param( 'slice' ); # generate URLs to next 3 slices for my $offset ( 1..3 ) { param( 'slice', $slice + $offset ); print a( { -href => self_url }, query_string ); } # restore original (if needed) param( 'slice', $slice ); __END__ Query: slice=31&this=that Output: slice=32&this=that slice=33&this=that slice=34&this=that Query: this=that&slice=49&that=this Output: this=that&slice=50&that=this this=that&slice=51&that=this this=that&slice=52&that=this Query: this=that&that=this&slice=5 Output: this=that&that=this&slice=6 this=that&that=this&slice=7 this=that&that=this&slice=8
Season with input validation/error handling to taste. :)
--k.
In reply to Re: Need to create a pre and post string from a REQUEST_URI
by Kanji
in thread Need to create a pre and post string from a REQUEST_URI
by S_Shrum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |