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

Re: extraction of data

by Utilitarian (Vicar)
on May 14, 2014 at 10:29 UTC ( #1086005=note: print w/replies, xml ) Need Help??

in reply to extraction of data

If you were to attempt to do this manually, what would be the steps?
  • Read the data source into a data structure using the name as an index (see associative arrays in perldoc perldata)
  • Ask for partial name chomp(my $name=<STDIN>);
  • Perform a case insensitive partial match of the name against the index (see perlre)
  • Iterate through the indices of the associative array printing out any that match the test above see perlsyn (foreach) and also the keys operator of associative arrays
Now all you have to do is try and write that in Perl, it'll break the first time and when you get rid of the error messages it won't do what you intended, but that's true of most of our projects,(and anyone who denies it is probably lying) to quote Greg Lemond "It doesn't get easier, you just get faster".

So put up the code you wrote and we'll try and hack it into shape, providing you with a complete solution is not helping you in the longer term.

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1086005]
[stevieb]: I am thankful that I fell into Perl years ago in the manner I did. I don't believe there is another language that people care about so much, that they're willing to give everything. Langs come and go, but in Perl, it seems, things remain consistent.
[stevieb]: The people back then (~2000) are the same people now, but with much more experience. I'm appreciative that I fell into the Perl rabbit hole.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-02-25 01:22 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (364 votes). Check out past polls.