in reply to here-docs vs quote operators
Although you're right about the quoting mechanisms, I wouldn't tell people to follow your examples. If there's a way not to use the string form of eval, take it. Creating an anonymous subroutine lets you write Perl code exactly how you should write it and without any worries about quoting. You don't have to worry about the difference in any of these.
my $hd = sub { '[]' =~ /\\[\\]/ };
In your last example, since you're already using an alternate delimiter, just choose one that doesn't show up in the data. That takes care of the syntax error quite nicely, and it's that reason we have alternate delimiters. Then you won't need three lines for a one line statement. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: here-docs vs quote operators
by ikegami (Patriarch) on Feb 16, 2006 at 21:38 UTC | |
|
Re^2: here-docs vs quote operators
by Anonymous Monk on Feb 16, 2006 at 21:37 UTC | |
by chromatic (Archbishop) on Feb 16, 2006 at 23:52 UTC | |
by demerphq (Chancellor) on Feb 17, 2006 at 10:26 UTC | |
by demerphq (Chancellor) on Feb 17, 2006 at 10:24 UTC | |
by Corion (Patriarch) on Feb 16, 2006 at 21:48 UTC | |
by Anonymous Monk on Feb 16, 2006 at 22:02 UTC | |
by Corion (Patriarch) on Feb 16, 2006 at 22:13 UTC |