Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Re: (ar0n) Re: Storing Info

by footpad (Monsignor)
on Jan 21, 2002 at 10:32 UTC ( #140328=note: print w/replies, xml ) Need Help??

in reply to Re: (ar0n) Re: Storing Info
in thread Storing Info

Um, ar0n's actually being nice. You should see him on a bad day.

Normally, your post would have been considered, reaped, and forgotten with no replies to speak of.

However, it's a weekend, so things are a little slow.

In any event, this isn't a place where people solve your problems for you. It's a place where you show them what you've tried and they point out places where you might look for the next step.

I can't speak for ar0n, but I'd probably start by going perldoc -f map and perldoc -f grep.

That done, I might even try perldoc -q sort hash and see if there's anything in the Friendly Manual provided with the language. (There certainly seems to be one or two things that apply. Have you tried them?)

Naturally, one can also try the same query on perldoc or (heck, why not live a little?) even here.

IOW, the Monastery best helps those willing to first help themselves. *That's* why you're getting some insubstantial answers.

For best results, take what you've been given so far, write some code, and then--if still stuck--post what you have and the specific problem you're working through. We'll help you through problems, but we won't do your [home]work for you.


Replies are listed 'Best First'.
Re: Re: Re: (ar0n) Re: Storing Info
by sickboy on Jan 21, 2002 at 10:38 UTC
    @routes=grep /$line/, @ {$rec->{'ADV'}};
    i want to grep the entire %friends. Every $rec
    For all people with brown hair and name starting with "j".
    Either answer or go away. You think I haven't looked around?
      Either answer or go away.

      Excuse me, but this guy went out of his way to give you a few pointers and you just insulted him. Any help is better than no help at all. Further, you probably haven't really looked at grep. If you had, the solution would quickly become obvious.

      Nobody here is going to hand you the code--you have to do it for yourself or you'll never learn. I will, however, hand you part of the code. @results=grep {SOMETHING} @friends{sort keys %friends};
      All you have to do is figure out what goes in place of the SOMETHING. It's not that difficult.

      --Brent Dax
      There is no sig.

        I really dont understand why everybody wants to sort the keys of the hash. I mean OP didnt say he cares about the keys...
        print join "\n",map{ (CONDITION) ? join(",",values %$_) : () } values +%hash;
        But I cant seem to work out what the CONDITION should be. Maybe the OP can work it out...

        Yves / DeMerphq
        When to use Prototypes?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://140328]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-04-23 00:14 GMT
Find Nodes?
    Voting Booth?