Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Read Hash reference from File

by nagalenoj (Friar)
on Nov 08, 2012 at 11:50 UTC ( #1002880=note: print w/ replies, xml ) Need Help??


in reply to Read Hash reference from File

Back into perlmonks after a long time. :)

Seems interesting. Since you don't want the order to be changed, I think you can try with PPI.

Here is a sample code, which I tried. You can make it better for your use.

use PPI; my $ds = PPI::Document->new('sample_config.pl'); for my $sub ( @{ $ds->find('PPI::Statement::Expression') || [] } ) { my $Tokenizer = PPI::Tokenizer->new( \$sub ); while ( my $Token = $Tokenizer->get_token ) { print "Found token '$Token'\n" if ( $Token =~ /\w+/ ); } print "---------------------------------------------\n" }

Hope it helps. Thanks.


Comment on Re: Read Hash reference from File
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2015-07-07 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls