perl -ple '%r=qw([ 1 ] 3);s/([][])/	$r{$1};/g' [download]
BTW, I had to use your script to type this post, so it's already useful :) -- Mike