#!/usr/bin/perl -w use strict; my $path = $ENV{'PATH_INFO'}; # omit the first '/' sign $path =~ s/^[\/](.*)/$1/; # read string like 'id/995/kk/2004-05/r/5' to @array my @keys = split /\//, $path; my %avain = (); my $i = 0; print "Content-type: text/html \n\n"; # let's go through all the indexes that split made while ($i <= $#keys) { # assign key-value pairs $avain{$keys[$i]} = $keys[($i+1)]; $i = $i+2; } # for debugging purposes while (my ($key, $value) = each (%avain)) { next unless $value; print "

$key = $value

\n"; }