#!/usr/bin/perl use strict; use warnings; my $b; for( $_ = "fred"; s/(.)//; ) { $b = $& if $&; print "I saw the character [$b]\n"; redo if $b eq 'e'; }