| |
| |
| |
|
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 33
Comments:
<0> sorry, cabdef <1> so a rotate? <2> guys <2> how can I get elements from 1 .. <last minus 1> in array without shifting ? <3> oops, no. <1> unshift @array, splice @array, $selected_item, 1; <1> that'll do it <4> eval: @x = qw(a b c d e f); unshift @x, splice @x, 2, 1; \@x <1> where $selected_item = 2 for "c" <5> mauke: ['c','a','b','d','e','f'] <4> eval: use List::Util 'first'; <5> mauke: <1> although that's a bit more expensive than you might want <1> if you're doing a lot of work <6> Sir_J: 1 .. $#array - 2 ? <6> Or rather -1
<4> eval: use List::Util 'first'; @x = qw(a b c d e f); unshift @x, splice @x, (first { $x[$_] eq 'c' } 0 .. $#x), 1; \@x <5> mauke: ['c','a','b','d','e','f'] <1> 1..$#array-1 leaves out the first and last elements <1> mauke++ <0> mauke, that searches for 'c' and moves it first, right? <4> right <0> core: List::Util <5> List::Util was added to Perl5.007003 <0> thanks guys <1> eval: @x = ('a'..'f'); $n = 2; @x[0..$n] = @x[$n, 0..($n-1)]; \@x <5> merlyn: ['c','a','b','d','e','f'] <1> that's a bit more efficient, I think <1> array slice ***ignlemtn <0> what's "\@x" ... some bot input? <4> reference to @x <1> it takes a reference to @x so that Dumper does the right thing <2> Ani-_, $#array is a very long expression <0> ok <1> it's the way for us to show @x at the end <1> eval: @x = ('a'..'f'); $n = 2; @x[0..$n] = @x[$n, 0..($n-1)]; join ", ", @x <5> merlyn: c, a, b, d, e, f <6> Sir_J: my $last_element = $#array; 1 .. $last_element -1; <1> that's another way <2> like $a->{...}...->{...}..............->, so to get $#array is not convinient <1> Sir_J - ***ign it somewhere then <1> my @result = do { my @temp = COMPLEX THING HERE; @temp[1..$#temp] } <7> Shuttle is about to launch. <1> for some meaning of shuttle, and launch, and about. :) <7> Space SHuttle, Nasa, thrust into the air with possible explosion. <2> is this right (undef, @newarr) = @arr ? <1> there are days when I wished I actually had food in the house <1> Sir_J to do what? <1> @newarr = @arr[1..$#arr] is simpler <2> to get all elements from array without first <2> I have no exactly @arr <6> Then perhaps you should start by telling what you DO have. <1> Sir_J - I just showed you what you can do <2> but very cimplicated construction which returns array like $a->{...}...->... <1> ... my @result = do { my @temp = COMPLEX THING HERE; @temp[1..$#temp] } <1> pay attention <2> merlyn, my way is simplier <6> You are talking about an array. Are you sure you have an ARRAY? And not a LIST? <8> z0mg what is this list you speak of <2> Ani-_, definitely list :) <6> Then why are you speaking since the start of an array? <2> just example <6> An example of a thing you are not using? And thus not having trouble with? <9> happy 4th of july everyone <10> go nasa! that was bad ***. <2> I've just asked if this is the simplier/best way of getting the whole list without first element <2> I mean --> (undef, @newarr) = @arr <1> Sir_J - I accuse you of XY problems <9> they launched it ? <7> Yes. <10> r3nd3r: you know it <6> Again you are giving an example of an ARRAY. Not of a LIST. <6> If it is an ARRAY then it is not the BEST way. If it is a list then maybe. <2> merlyn, what is XY ? <1> perlbot, xy problem <11> They ask how to do X, but that's because they really want to do Y but think X will get them there and most of the time they are WRONG
<1> basically, you gave us such a small part of the problem that the solutions are convoluted <1> but if you back up a step, we might be able to tell you a far better way to do it <2> I mean --> (undef, @newarr) = <some expression which returns a list> <10> you guys are killing him. <1> Sir_J - that's ugly. time to back up a step! <1> YOU HAVE: complex expression returning a list <2> merlyn, ok-ok <1> YOU WANT: list minus first and last element <1> SOLUTION IS: (as I've said before) <2> nope <2> just <some complex expression without first element> <1> what generates the list? <1> can you ask that to not spit out the first element? <1> this is why it's an XY problem <1> you need to back up a step <12> eval: @foo = qw(a b c d); @bar = @foo[1..@foo]; \@bar; <5> eggzeck: ['b','c','d',undef] <1> eggzeck - off by one <6> ... Typical. Initially you said: '1 .. <last minus 1> in array'. Now you are saying you just don't want the first element. Make up your mind. <1> $#foo not @foo <12> Ahh yes :) <13> is it possible to store a cl*** in a variable? I'm thinking something like $foo = \Actions::Cl***Name; then $foo->new() will instantiate the cl*** $foo? <1> Ani-_ - right <1> just $foo = "Actions::Cl***Name" <1> that'll work fine <1> no need for a reference <14> seen tag <1> that's how all constructors work anyway. :) <14> .seen tag <15> tag was last seen one day, 39 minutes and 2 seconds ago, quitting FreeNode ("leaving"). <13> got it. Thanks merlyn. <9> 3.9 kernel ? <9> FreeBSD ? <16> openbsd maybe <14> definitely obsd <17> OpenBSD just release 3.9 not too long ago <16> freebsd is in version 6 or something <3> also, he spoke of the upgrade some hous ago. <14> I mean it is definitely OpenBSD as merlyn uses that. <3> BinGOs has a database. <17> yes, merlyn uses OpenBSD and OS-X if i am not mistaken <14> Please to not be doubting meh. <17> all hail the might BinGOs ! <17> damnit i can't type today <14> >:) <14> Damn it, I wish this download would hurry up. <17> what are you downloading? <14> Enemy Territory Fortress <17> is that an add-on to ET or a new game entirely? <14> add-on to ET <14> me neither tbh. <14> I know these lunatics who play it. They have a PoCo-IRC based bot logging server traffic to an IRC channel. <14> pretty neat really. <17> yeah, that is neat <14> does rcon stuff as well. People in the IRC channel can send messages to the server etc. <17> hah.. you could echo the console output to IRC probably. that would be ... interesting <18> BinGOs: Does it use the rcon component? <14> Nope. <17> BinGOs: now that is nice <18> Aww. dw will be sad. <14> dngor: remember helios, well it is his bot. <14> it uses FollowTail on the server logfile from what I can gather. <14> \o/ dl complete and installing. <19> "DrCurl" at 132.203.103.174 pasted "Filling a hash with array elements. What's wrong with this? I get syntax error at ARErandom.pl line 4, near ") {"" (8 lines, 154B) at http://sial.org/pbot/18209 <20> Hi BinGOs, dngor, pravus <20> BinGOs: are you using Windows? <17> rindolf: ahoy! <20> BinGOs: I mean using Perl on Windows. <21> DrCurl: missing ; <22> oups <20> pravus: ahoy matey!
Return to
#perl or Go to some related
logs:
varchar or tinytext genpatches/tarballs/ xml #gentoo no ttyusb0 #perl k3b runing as root pl/sql check string cap #debian WD400 Failed #linux
|
|