@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32



Comments:

<0> Well... Stranger things have gone for oscon lightning talks?
<1> really? I'm pretty clear on what I consider to be an extension, and lacking his definition, I'm going to go with that
<2> Somni: okay, that'll work.
<3> Masque, it doesn't work because you can't push an array into a hash.
<1> if he doesn't like it, well, he can fix it himself
<4> Peyomp_: You can push an arrayref, though.
<3> I know
<3> But that is what I'm TRYING to do. I think I've expressed it... except for that one detail.
<2> you can't push anything into a hash :)
<5> Somni: what about The.Lost.s02.e04.xvid.purplemonkeys.avi ? :)
<3> Eclipse informed me it would fail.
<3> But... I'm hoping you can point out another way :)
<3> Now that its actually in perl.
<1> hobbs: frankly, it belongs in a sort group all by itself
<6> hi



<4> Peyomp_: \$tbl_ary_ref is not what you mean - you mean @$tbl_ary_ref
<7> my %slotIDs = {};
<4> Unless you really want @table_array to contain one element, which is a reference to $tbl_ary_ref
<3> no, I wanted it to contain the contencs or $tbl_ary_ref
<8> /(\w+) (is|are) (.*)/i why is this not working?
<3> err contents
<6> my $slotIDs = {} or my%slotIDs = (foo => bar); no ?
<9> given a sub ref can you print the subroutine that it refers to?
<2> g0st: you haven't paid its wages.
<3> So I really wanted @$table_ary_ref eh?
<4> Yes, because that says "treat this as an array".
<4> i.e. "GIMME THE INSIDES!"
<1> g0st: do you really expect anyone to realistically answer that, with no idea what input you're trying to match?
<5> \$table_ary_ref is a reference to your reference to awn array -- i.e. it's going the opposite direction
<8> I'm trying to match a definition, like what you are reading now.
<3> Right. Fixed.
<5> Peyomp_: have you been through perlreftut?
<4> Fix it below with $tmp too.
<4> Actually
<3> I have, but I'm rusty.
<1> g0st: so you want to match (you) (are) (reading now.)
<3> Fixed there too.
<5> @find () () (reading now)
<4> So now you have arrays full of what you mean.
<10> biz is reading now | but I am reading now | wife is reading now | i am reading now | please to be reading now
<4> But if you're going to make lists of lists, you have to use array refs.
<8> Somni: well (\w+) should be the word and (.*) should be the expression/definition to go along with it.
<1> was that a yes or a no?
<4> Peyomp_: You don't want push there.
<4> You just want $slotIDs->{$_->{slotID}} = $_ for @table_array
<8> Somni, no if you mean literally "reading now".
<8> lol
<1> that's what your regex would match
<8> Well when it stores nothing in either.
<5> eval: $_ = "you are reading now"; [/(\w+) (is|are) (.*)/i]
<11> hobbs: ['you','are','reading now']
<2> gost: "foo is bar" =~ /(\w+) (is|are) (.*)/i; # What do you think should be in $1, $2 and $3 ?
<3> But I must push more than one $_ into it, yeah?
<1> eval: $_ = "<8> I'm trying to match a definition, like what you are reading now."; [/(\w+) (is|are) (.*)/i]
<11> Somni: ['you','are','reading now.']
<4> Ah, I see.
<4> Yes, in that case, you want it to be an array.
<3> So I need to get an array in the hash and have that hold array references...
<4> push @{$slotIDs->{$_->{slotID}}}, $tmp
<2> g0st: note that you are matching literal spaces in your RE. Odds are that you don't want to do this. You probably want to match one or more whitespace characters \s+
<3> ah ha
<3> Whoah, lemme try and parse that
<5> Peyomp_: add spaces ;)
<1> or temporaries
<8> ok i think i got it
<1> $slotID = $_->{slotID}; $value = $slotIDs->{$slotID}; push @{$value}, $tmp;
<8> lets see.
<5> push @{ $slotIDs->{ $_->{slotID} } } is at least somewhat more amenable to reading :)
<3> Am I correct in saying that this results in an array of array references residing in the hash that has the slotid as its key?
<5> but I would go with the temporaries as well.
<1> I wouldn't go with temporaries in actual code, I'm just saying that's one way of visualizing it
<3> Trying to grok... gonna take a minute.
<4> Peyomp_: It's just what you want. It says, Push this thing onto that array.
<1> the temporaries version is also flawed
<5> Somni: I probably would, up to the first level. I probably want $_->{slotID} again soon, might as well give it a nice name
<3> And that array is within the hash, yes?



<4> But because it's not an array, you have to tell perl, "Hey, I'm going to give you a reference, and you're going to treat it as an array ref."
<3> Okay, I think I get it
<4> $slotIDs->{$_-}{slotID}} is an array reference.
<4> Oops, typo.
<12> "My angsty teenage bull**** has a body count."
<4> $slotIDs->{$_->{slotID}} is an array reference.
<4> Or will be once you're done with it.
<4> And that's why you wrap it in the @{}
<4> That tells perl what you mean.
<5> GumbyBRAIN: when you see him in the subway he'll be down at the end of the car, watchin you move until he knows he knows who you are
<0> error: syntax error at (eval 158) line 16, at eof missing right curly or square bracket at (eval 188) line 16, at eof.
<3> What is $tmp? I had it as @tmp
<4> $tmp is an array reference.
<3> my $tmp = @$_;
<3> ok
<4> You could still make it @tmp, but then you'd need to do this:
<4> push @{$slotIDs->{$_->{slotID}}}, \@tmp
<5> Peyomp_: nono. my $XXXX = @YYYY is wrong, except in the case where you want the number of items in (YYYY)
<4> If you don't, you'll end up with one BIG list made from the lists you give it, concatenated.
<4> i.e., push @foo, @bar, @baz gives you @foo with the elements of bar and then the elements of baz.
<4> What you want is to have an array with references to the arrays.
<4> So that you have a list of lists, instead of a list of items.
<3> So what I end up with when I run that is a hash that has the slotID as the keys, and the value to each key is a reference to an array of arrays holding the values?
<4> Yes.
<4> Use Data::Dumper and watch.
<3> Okay, I had an aha moment but the fact that the @{} was on the outside seemed strange.
<3> I'll paste the new version
<4> Peyomp_: It needs that because push requires an array there.
<4> Type of arg 1 to push must be array (not private variable)
<4> et cetera
<13> "Peyomp_" at 67.33.170.80 pasted "Mulligan!" (21 lines, 848B) at http://sial.org/pbot/18674
<4> Nope.
<4> $tmp is now the first element of @$_.
<3> Yeah, I knew it needed to be an array when I wrote the code, but I also knew you could probably fix it if you had something to go by.
<3> remove @?
<3> my $tmp = $_;
<14> "select *"?? Gyah, don't do that
<3> I need all the values
<4> push @{$slotIDs->{$_->{slotID}}}, $_ for @table_array;
<14> Also why are you using qq{} on something which is already a string?
<14> Peyomp_, so enumerate all your columns
<4> Brend: Can we PLEASE do one thing at a time?
<14> Masque, no way!
<4> You're fired.
<3> I didn't remove qq because it was in the example.
<12> Awesome.
<14> You can't fire me, I quit!
<3> And because it runs.
<12> Exxon makes $1,318. Per second.
<3> And actually I think I read something once about how you can't overuse qq.
<4> push @{$slotIDs->{$_->{slotID}}}, $_ for @$tbl_ary_ref;
<12> qq( qq( foo ) );
<14> Well it doesn't _hurt_
<14> It just doesn't do anything
<5> Peyomp_: you were reaading the wrong thing :)
<3> perhaps
<12> eval: qq( qq( foo ) );
<11> ew73: qq( foo )
<12> I feel totally jipped.
<4> Peyomp_: And the reason it's @$tbl_ary_ref instead of @{$tbl_ary_ref} is...
<14> They used to have these things you could swap your fries for in McDonald's, called QQ Balls
<13> "Peyomp_" at 67.33.170.80 pasted "Redo redo" (15 lines, 612B) at http://sial.org/pbot/18675
<14> They were kinda baked cheese thingies. They were awesome
<14> Then I started buying them all the time, so they stopped selling them
<14> Mother****ers
<4> Peyomp_: Getting closer! Now...
<3> Because we're looping through an array
<12> On the VN boards, you properly say 'qq noob'.
<3> Can you for a hash?
<15> Wendy's used to have a great apple dumpling
<4> push @{$slotIDs->{$_->{slotID}}}, $_ for @{$sth->fetchall_arrayref({})};
<15> and also whole wheat buns for their burgers
<5> Peyomp_: you can iterate over its keys and/or values


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #perl
or
Go to some related logs:

#ubuntu
#lgp
#mysql
postfix sasa bounced smtp relay status
#kde
#oe
iandoh.co.uk
chrisg631
basbryan
netapp+mountvers



Home  |  disclaimer  |  contact  |  submit quotes