Thread Ersetzung von $( verhindern (15 answers)
Opened by bianca at 2011-04-23 15:12

MatthiasW
 2011-04-26 15:04
#147997 #147997
User since
2008-01-27
367 Artikel
BenutzerIn
[default_avatar]
Doppelte Anführungszeichen sollte man aber auch noch escapen, da sonst aus Versehen Code ausgeführt werden könnte:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w
use strict;
use warnings;

my $var= <<'HTML_AUSGABE';
ein bisschen $(
und noch mehr $ (
und noch noch mehr $   (
";

print "your code here\n";

"
HTML_AUSGABE

# quote "$("
$var=~s/(\$\s*\()/\\$1/gs;
$var=~s/"/\\"/gs;

print eval(qq{"$var"});

MfG
perl -E'*==*",s;;%ENV=~m,..$,,$&+42;e,$==f;$"++for+ab..an;@"=qw,u t,,print+chr;sub f{split}say"@{=} me"'

View full thread Ersetzung von $( verhindern