my %seps = ( '\\t' => "\t", '\\n' => "\n", # etc ); my $input = <>; my $separator = $seps{$input};