#!/usr/bin/perl use strict; use warnings; use 5.024; use utf8; my $RE = qr/v=([\w\-^&]+)/; for my $data () { my $catch; say "$catch Match!" if ($catch) = $data =~ $RE; } __DATA__ v=99&t=91a v=o v=1&&&& v=&&&& __END__ ergbt: 99&t Match! o Match! 1&&&& Match! &&&& Match!