| |
| |
| |
|
Page: 1 2 3
Comments:
<0> my(@DNSDB, %exists); push @DNSDB, [ '', split ',', $line ] while(chomp($line = <DHCP>)); local $\ = "\n"; print join ', ', grep {!$exists{$_}} @{$_->[1]} foreach(@DNSDB); <1> hehe <0> er <0> () precedence will be an issue with that print <0> my(@DNSDB, %exists); push @DNSDB, [ '', split ',', $line ] while(chomp($line = <DHCP>)); local $\ = "\n"; print join(', ', grep {!$exists{$_}} @{$_->[1]}) foreach(@DNSDB); <0> that should print all unique items, comma delimited, for each sublist <0> and, compiles the list as ya see, in that format, as thats what it expects <0> umm <0> my(@DNSDB, %exists); push @DNSDB, [ '', split ',', $_ ] while(chomp(<DHCP>)); local $\ = "\n"; print join(', ', grep {!$exists{$_}} @{$_->[1]}) foreach(@DNSDB); <0> duh <0> sorry, blah <0> oops <0> dfldlkfjlsddjspi <0> meant to throw loal $_ = in there
<0> locl rather <0> sdfkhsd <0> **** i cant type <1> its late I understand <0> lol <0> have been up all ****in night working on things, thought processes are a bit limited <1> Yeah, I've been trying to fig out a way to do this but I know I was stuck, so I sought better help then myself. <1> Can't modify <HANDLE> in chomp at ./dcout.pl line 31, near "<DHCP>)" <0> well, yes <0> any of those ways would filter those items <0> that approach in itself I've used a million times for similar things <1> I think I'm getting how the grep is being done though. <0> is just, need to account for how you compile your lists.. <0> yea, well <1> I know, hash would have been easier I think. <0> well <0> all those ***ignments <0> could be skipped totally <1> Ok, im interested <0> my(@DNSDB, %exists); push @DNSDB, [ '', split ',', $_ ] while(chomp(local $_ = <DHCP>)); <1> I do this a lot <0> would accomplish pretty much exactly the same thing <1> I was tought that I should alway bring in the data into a VAR in the language first then mod my VARs <0> well, theres never anything you *should* do <1> right. <0> keep yaself open to any approach you might deem necessary in any given situation <2> . o O ( David Brin: Glory season ) <1> I just work with a lot of programmers and they go ape **** on stupid things. <0> yea <0> well <0> that approach, to pull things out <0> stack them in memory <0> needlessly.. <0> I would frown on more than smply, not <0> uh <1> =) <0> ya cnt rely on anyone elses instincts I guess <0> I dnt see the need in pulling anything ya dont need out <0> for any amount of time <0> is just wsteful <0> so, smack said *programmers* for me? <0> I dun much agree with any of that.. <0> is problem solving.. <1> =) Will DO! <1> trying <0> approaches are unique to the person, and wasteful is never a good thing <0> suppose in the end, all that matters is getting done <1> right, thats what I belive in. <3> oh man, that looked like fun. wish i was here earlier <1> =) <0> hmm <0> am bored outta my mind yea <1> still foolin with this. <3> shortest factorial function. go! <1> =) <3> sub f{eval join"*",1..shift} <3> can you beat that? ;) <0> though what purpose might that ever serve? <3> alleviating boredom <0> ahh <0> I'm all for that
<3> hmm.. care to try fibonacci? <0> and, what might that be? <2> *snort* <2> ah, that fibonacci... <3> http://en.wikipedia.org/wiki/Fibonacci_number <0> I liked his reference to white powdery substances better <2> and now Titius-Bode... <3> hmmm... sub f{my@x=(1,0);for(1..shift){$x[2]=$x[0]+$x[1];shift@x;}$x[1]} <4> hrm.. you golf? <3> short code is fun, but unreadable. intermediate variables being stacked needlessly in memory can do wonders for a program's readability - and thusly its maintainability and usually its correctness too <3> nah, just trying to make a point <4> how you should write your code depends on you and what you know, and of course your "audience". the interpretter is not always your only audience <3> consider that avoiding the waste of cpu and ram can often lead to wasting programmer time which is often far more valuable <3> i can't think of any non-hobby cases where the interpretter is the only audience. in my experience, most code is revisited <4> if it's only revisited by you, and you're comfortable in reading/modifying your own code, it's not such a big deal <3> i've wasted my own time before ;) <3> that said, i'm rather comfortable with map and will write list-centric code that baffles coworkers <3> so yes, it's about the audience. if you're writing code for beginners, you should probably break everything down step by step <4> btw, regarding your golfs there.. pop < shift if you're only expecting 1 argument to your function :P <3> nicely done :) <2> that's not Titius-Bode <3> a little shorter: sub f{my($a,$b)=(1,0);for(1..pop){($a,$b)=($b,$a+$b)}$b} <4> oh, you're trying to return just the nth fibonacci number? <3> yep <4> a wee bit of fun with it: sub f{($a,$b)=($b||1,$a+$b)for 1..pop;$b} <3> Mariandroid: sub t{(4+3*(2**(-1+pop)))/10} <4> what's titus bode? <3> http://en.wikipedia.org/wiki/Titus-Bode_law <4> that doesn't account for the first number though <3> mine? <3> mercury's k = 0 <4> yes <4> 2**0 is 1 <3> er, "it starts at 0" <4> 2**-1 is 0.5 <4> you're only using the powers of 2, but that will never yeild k when multiplied by 3 <4> er.. never yield k as 0 <3> oops <3> bahahaha: sub t{(4+3*(2**(-1+(pop||return.4))))/10} <4> uh <5> system(@args);my $res=$? >> 8; <-- works when command exits with 0,1,2 (res=0,res=1,res=2), but when command exits with -1, res=255. why? <4> because it's signed? <5> then how do i get exit code when its <0? <4> i'm not sure i understand the issue <5> i try to get commmands exit code <4> by right shifting $? <4> ?> <4> blah <5> "The return value is the exit status of the program as returned by the wait call. To get the actual exit value divide by 256" <3> x >> 8 != x / 256 <4> indeed it does not <3> i was about to copy and paste the same text, zero-gravity <5> "The return value is the exit status of the program as returned by the wait call. To get the actual exit value, shift right by eight" <4> you're a looney <5> and what does that mean? <4> means you're nuttier than a fruitcake <3> "The return value is a nutritious part of this balanced wait call. To get the actual exit value, send cheque or money order to P.O. Box 872138." <5> well, how do i get that exit code from a command then <4> do breakfast cereals still have UPC send in offers? <4> i miss those <4> zero-gravity: subtract 256? just a guess though <5> is there another way without inspecting if($?<256) <4> ... <4> just <4> divide <4> by <4> 256 <4> shifting is a nifty way of pretending to divide by 256 with the unfortunate side effect of bringing a SIGNING bit into a highly significant digit <3> no, i think that the docs are describing a non-portable approach <3> http://www.nntp.perl.org/group/perl.perl5.porters/49984 <3> Instead, use the POSIX W*() interfaces: for example, use <3> WIFEXITED($?) an WEXITVALUE($?) to test for a normal exit and the exit <3> value, and WIFSIGNALED($?) and WTERMSIG($?) for a signal exit and the <4> well if the return call is -1 as in 1111111111111111, and you right shift to get 0000000011111111, then you are certainly going to get 255
Return to
#perl or Go to some related
logs:
zeich heil DARAHMUDA #allnitecafe #allnitecafe #allnitecafe What is placement new? Why would you use it? in c++ #chat-world #allnitecafe gentoo feh ERROR: Couldn't load image in order to set bg #php
|
|