@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> hey guys
<0> anyone know how i can push() a array for multi purposes
<0> like i need to push it to @array[id]
<1> @array[$id] is an array slice
<1> didn't i tell you this before? learn the correct nomenclature please
<0> dude
<0> im talking
<0> i want to add it for multi array



<0> so i can return everyones processes with @array[$user-id, 0-maxprocs]
<1> you're talking? what is that supposed to mean? i thought that was a given
<1> i don't know what a "multi array" is, or what "multi purposes" could be
<0> like 2 dimentional arrays
<1> thank you
<1> see now, this is precisely why you need to use the correct nomenclature: @array[$user-id, 0-$maxprocs] is perfectly valid and will return 2 elements from the 1 dimensional array @array
<0> ok so how could i do a 2 dimentional one?
<0> i was looking on google
<1> you want an array of arrays
<0> yea
<0> ok nwo i know the name ill google it :D
<1> thanks to perl's autovivification...
<1> you want: $array[$index1]->[$index2]. the dereference operator -> is actually optional
<0> cool :D
<1> note that @array is still 1 dimensional, but its elements will be array references
<0> -> have any seg value?
<1> seg?
<0> segnificant
<0> is it needed for any certain reason
<1> significant? no, it's redundant in that context because perl knows that ][, }[, ]{, and }{ wouldn't be valid without dereferencing, so perl DTRT
<0> ok
<0> :)
<1> just know that it's going on. if you try to print $array[$index1] after ***igning something to $array[$index1][$index2], you'll see "ARRAY0x081343"
<0> brb gotta look up arrays of arrays to figure out how there used correctly in perl
<1> i really wish @array[$scalar] triggered a warning
<1> one gotcha with multi-dimensional arrays in perl is that testing an element auto-vivifies all the arrays up til the last dimension
<2> @array[n] does trigger a warning on my system.
<3> how do i remove ( and ) with regex? ;\
<2> Of course you have to have warning enabled. :)
<3> $str =~ s/(/g;
<3> something like that ;\



<2> You need a right side to s///
<2> but you better use tr/// for that.
<3> heh
<0> @array{string} is correct right?
<0> or do i have to use a hash of array?
<1> $hash{$string_key}
<1> the next time you use array slice nomenclature to refer to a single-element lookup, i'm putting you on ignore, crypted
<1> arrays have numeric indices, hashes have string indices
<0> would i my a hash just like a array
<1> verb?
<0> because im getting a global array on it but i have it my $hash; at the top
<1> ahh yes, good point TopMach. i usually don't recommend use warnings; to beginners because i turn off three of them personally by default
<0> i mean you know how you was teaching me to use my
<0> like my @procnames;
<0> well its not recognizing the hash my $userids;
<0> Global symbol "%userids" requires explicit package name at ./ps.perl line 28.
<1> i don't understand. can you pastebin a short example?
<0> ok
<0> :)
<1> wow, it's been a while since i've written any perl. i've forgotten which are the three warnings that infuriated me so much
<1> ahh. qw/uninitialized numeric/. i swear there was another as well
<0> http://pastebin.com/656865
<0> the global warning
<0> memans i did not identify it with the "my" command
<0> but it is
<1> my %userids;
<0> ok... but i still use the $ to return it right?
<1> it's a hash, so when you refer to it as a hash you must use a %. when you extract a single value, you use a $
<1> yes, same with arrays
<1> @userids{} would be a hash slice, which is not what you want
<1> my %hash; $hash{"foo"} = 1; my @array; $array[0] = 1;
<0> :)
<0> thanks
<1> no worries
<4> hello


Name:

Comments:

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






Return to #perl
or
Go to some related logs:

#india
#kl
#allnitecafe
#kl
fairlight she -kate-bush -glen -keyboard -planet
who am i made to be why tell me why tel me whyyy
#india
#assembly
choli ke peche kia
#chat-world



Home  |  disclaimer  |  contact  |  submit quotes