in reply to input special characters
Result:use strict; use warnings; my $t = '\\t'; print "$t:\n"; my $evaled = eval "qq/$t/"; print "$evaled:\n"
\t: :
(perlmonks changes literal tab to several spaces, heh)
Than again, maybe eval is more trouble than it's worth. I'd say a hash with all separators that you want to use would work better:my %seps = ( '\\t' => "\t", '\\n' => "\n", # etc ); my $input = <>; my $separator = $seps{$input};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: input special characters
by kepler (Scribe) on Jul 13, 2014 at 13:17 UTC | |
by Anonymous Monk on Jul 13, 2014 at 15:30 UTC |