Thursday, 9 May 2013
Perl regular expression tip
An easy one to forget when using perlre
See red brackets
The difference between this..
my $genArgs = ($foo =~ /genericJvmArguments \[(.+)]]/);
and this...
my ($genArgs) = ($foo =~ /genericJvmArguments \[(.+)]]/);
Is that the first one yields $genArgs set to 1 (which is what you don't want)
whereas the second version yields something like $genArgs set to -XX:ParallelGCThreads=2 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -d64 -XX:MaxPermSize=512m (which is exactly what you do want)
In the first version I forgot the brackets around the $genArgs variable
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment