!/usr/bin/perl -w use strict; my $story; { local $/ = undef; #Get everything $story = <>; } while($story =~ /\[(.*?)\]/g) { #Find anything in [] print "Give me a $1: "; my $val = ; #Get a value for it chomp $val; $story =~ s/\[$1\]/$val/; #And sub it in } print $story;