#!/usr/bin/perl -w use strict; my $content = 'foto1=8&foto2=40&'; my (%hash, $skip, $old); map { $skip++; $hash{$old} = $_ unless($skip == 1); $skip = 0 if ($skip == 2); $old = $_; } ($content =~ /foto(.)=([0-9]+)&/g); print "Foto '$_' hat den Wert '$hash{$_}'\n" for (keys(%hash));