http://www.perlmonks.org?node_id=208389


in reply to Matching over multiple lines in a scalar

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $info; $info .= $_ while(<DATA>); my %lines; while($info =~ m/(?:^|\n)(\d+)\:(.+?)(?=(?:\n\d)|$)/gs) { $lines{$1} = $2; } print Dumper (\%lines); __DATA__ 3: Tag <test> found Tag <test> found 5: Tag <test> found 7: Tag <test> found 14: Tag <test> found 16: Tag <test> found 18: Tag <test> found 21: Tag <test> found 25: Tag <test> found 27: Tag <test> found 29: Tag <test> found 32: Tag <test> found 34: Tag <test> found 49: Tag <test> found 80: Tag <test> found 98: Tag <test> found Tag <test> found

Gives

c:\test>208384 $VAR1 = { '29' => ' Tag <test> found', '21' => ' Tag <test> found', '7' => ' Tag <test> found', '14' => ' Tag <test> found', '80' => ' Tag <test> found', '32' => ' Tag <test> found', '16' => ' Tag <test> found', '49' => ' Tag <test> found', '25' => ' Tag <test> found', '3' => ' Tag <test> found Tag <test> found', '98' => ' Tag <test> found Tag <test> found', '34' => ' Tag <test> found', '18' => ' Tag <test> found', '27' => ' Tag <test> found', '5' => ' Tag <test> found' }; c:\test>

Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy