#!/usr/bin/perl use warnings; use strict; my $text = "One Two Three 456 Seven"; while ($text =~ /[0-9]+/g) { print " \$& = $& \n \$` = $` \n \$' = $' \n"; }