You can also look for the =~ operator and then print the next significant
token:
#!/usr/bin/perl
use strict;
use PPI;
# warnings should always go last
# https://stackoverflow.com/a/38639882/78259
use warnings;
my $file = shift or die "Need a file name!\n";
my $document = PPI::Document->new( $f
On 06/13/2017 05:14 PM, Chas. Owens wrote:
> Two notes:
>
> Firstly, $document->find will return undef if no regexes are found, not an
> empty arrayref, so you should say
[snip]
> Secondly, PPI does not catch all things that can be considered regexes, for
> instance:
[snip]
Thanks. I appreciate
Two notes:
Firstly, $document->find will return undef if no regexes are found, not an
empty arrayref, so you should say
my $regex = $document->find('PPI::Token::Regexp') || [];
or
for my $expr ( @[ $regex || [] ] ) {
or even
print qq(\n$file :\n);
if (my $regex = $document->find('PPI::Token:
Ok. Thanks, Paul and David.
I think I see how I can benefit from Text::Balanced but I now have my
start with PPI and can list the expressions.
Regards,
Lars
#!/usr/bin/perl
use strict;
use warnings;
use PPI;
use Data::Dumper;
my $file = shift or ( die("Need a file name!\n") );
my $document =