#!/usr/bin/perl -w $x = "123 56"; $x =~ / /g; print "$x, ", pos($x), "\n"; { local *x } # <--- print "$x, ", pos($x), "\n";