Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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(''); 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002880]
[thepkd]: Hey 1nickt sorry man. What
[GotToBTru]: a ref too far ;)
[thepkd]: Yes this is my first time in cb. Trying to work my way around.
[JohnCub]: "A ref too far" would make a good title for anyone's perl memoirs
[thepkd]: Anyways it works with $aohoaoh[0]->{'foo '}[0]->{'bar'}
[GotToBTru]: "I did it my $way"
[JohnCub]: I hope $way isn't a hashref. ;)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2016-12-06 13:44 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (105 votes). Check out past polls.