Home Page   #c  #ruby-lang  #cisco  #mysql  #apache  #javascript  #java  #perl  #php  #openmoko   Wallpapers Girl
Reliable $1 Web Hosting by 3iX

Channels


#perl

21 October 2007


Total 33 pages. You are browsing page 5/33.

First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last

05:23 <****> Ping the Percyless.
05:23 <****> slango: the code needs a complete rework, but as it stands you have a few serious problems
05:24 <****> slango: @decAcc and $decAcc are two different variables; you're passing $decAcc to printDecAcc
05:24 <****> slango: if you want to geet into discussing the algorithm anyway
05:24 <****> slen same for @recAcc and $recAcc; you need to pass a ref to the array, and stop with the ARRAY_SIZE business
05:24 <****> slango, rather
05:25 <****> slango: then, in your print functions, iterate over the array with a foreach, not a C style for loop
05:27 <****> once you've done that, show your code again, it may be possible to incrementally turn this into a Perl program
05:27 <****> Somni, yeah. I thought there was someting fishy about the ARRAY_SIZE constant, but I wanted to get it working using as closely as I could to what she had before I tried to optimize it
05:27 <****> would PDL make it easier?
05:32 <****> so if I'm doing printDecAcc(@decAcc); would I do my @decAcc = $_[0]; or my @decAcc = @_[0];?
05:32 <****> no, you need to dereference $decAcc, given it's an arrayref
05:32 <****> inside of sub printDecAcc
05:32 <****> see perlreftut, Use Rule 1
05:34 <****> N == number of elements in @decAcc
05:35 <****> ralf__, I see
05:35 <****> perl is clearly much more complex than PHP
05:35 <****> slango: And in many respects much simpler.
05:35 <****> ... but much more consistant
05:35 <****> if you spend any amount of time programming PHP becomes needlessly complex
05:35 <****> and perl has the cryphologic feature!
05:36 <****> the word is "flattening"
05:36 * f00li5h dons the fireproof undergarments
05:36 <****> all the little stupid rules that are not consistent become an impediment
05:36 * Patterner pours cold water over f00li5h
05:36 * f00li5h shakes and sprays the rest of the channel
05:37 <****> slango: Had you learned perl first it would be a snap to pick up PHP. I had a coworker rewrite a perl program in php in just a few hours having never used php before.
05:37 <****> PerlJam, I actually tried learning Perl first
05:37 <****> back when I was like 14 or 15
05:37 <****> pity you didn't continue.
05:37 <****> PerlJam: the catch is that you can't use any of the perl idioms, and it just expands crazily
05:37 <****> but gave up because I was like "What's with the command-line bull?"
05:37 <****> little did I know...
05:37 <****> f00li5h: tell me about it, I have to maintain php code in my day job.
05:38 <****> PerlJam: often i have a # in perl these 12 lines would be ...
05:38 <****>
05:38 <****> I'm guessing some character I can't display
05:38 <****> f00li5h: join(" ", array_map('name_of_function',$array)) # this one really bugs me.
05:38 <****> but I rarely run into those
05:39 <****> PerlJam: array_map -_- i just got a 6 month php contract ... starting tomorrow
05:39 <****> bla
05:39 <****>
05:39 <****> if i didn't need the money for rent and the such i'd never have done it
05:40 <****> i need a regex to keep only the part of a string before the \n
05:40 <****> tatica_: isn't all of the string before the \n?
05:40 <****> f00li5h: the market's against you!
05:41 <****> tlhiv_laptop: perhaps you just want split() ?
05:41 <****> perhaps
05:41 <****> tlhiv_laptop: ($thing) = split /\n/; # one method
05:41 <****> alright, so I passed \@decAcc and \@recAcc to printDecAcc and printRecAcc, respectively
05:42 <****> thanx
05:42 <****> jdv79_: wah?
05:42 * CPAN upload: Apache2-ASP-1.19 by JOHND
05:43 <****> would you of taken that job minus the financial pressure?
05:43 <****> so, now, inside of the subroutine, do I assign the array by reference again? would it be my @decAcc = \@_[0];?
05:43 <****> tlhiv_laptop, $ perl -le '$_="abc\ndef\nghi\n"; print $1 while (/.+(.)$/mg)'
05:43 <****> i have an array of strings @ltxpack
05:43 <****> i'm printing each of these
05:44 <****> put when i print it prints the \n at the end and i don't want that
05:44 <****> chomp?
05:45 <****> tlhiv_laptop: yeah, chomp() is probably what you need
05:45 <****> if I have the a string with fixed width data fields and I know all my startpositions and legths of each field, whats the best way to pull the data out?
05:45 <****> jdv79_: hells no
05:45 <****>[0]; }
05:45 <****> prakriti: unpack
05:46 <****> k, ty
05:46 <****> i can't get it to work
05:46 <****> prakriti: unpack (in case you don't believe Somni :)
05:46 <****> slango: no, once again, you need to dereference; $_[0] is an arrayref
05:46 <****> slango: did you read perlreftut?
05:46 <****> tlhiv_laptop: show your code (on a pastebot)
05:46 <****> ok
05:47 <****> The Cathedral and the Bazaar
05:47 <****> http://pastebin.mozilla.org/222414
05:47 <****> Somni, I only read rule 1
05:47 <****> I'll finish reading
05:47 <****> tlhiv_laptop: heh.
05:47 <****> hehe ;)
05:48 <****> tlhiv_laptop: you're using chomp() quite incorrectly.
05:48 <****> i tried chomp($ltxpack[$n])
05:48 <****> tlhiv_laptop, $ltxpack[$n] = chomp($ltxpack[$n])
05:48 <****> ralf__: bzzt! you lose.
05:48 <****> sorry
05:48 <****> if i wanted to do image manipulations in perl I'd want to use PDL, right?
05:48 <****> Doesn't anyone read documentation anymore?
05:48 <****> it just spits back "1"
05:49 <****> jdv79_: I'd use Imager
05:49 <****> jdv79_: depends on what you mean by "manipulations" PDL is just a fast number cruncher.
05:49 <****> special transforms
05:49 <****> its not a normal operation
05:49 <****> PerlJam, hrm, chomp modifies its arg, thats new to me
05:49 <****> jdv79_: yeah, you can do all sorts of transforms with PDL. fourier, convolutions, whatever.
05:50 <****> it's giving me $ltxpack[$n] = 1 for each $n
05:50 <****> tlhiv_laptop: Are you sure it's a \n ?
05:51 <****> yay
05:51 <****> no ;)
05:51 <****> unpack is lovely
05:51 <****> (you said chomp($array[$i]) didn't work)
05:51 <****> much better than a reg
05:51 <****> when i print it without chomping it prints a linebreak


Total 33 pages. You are browsing page 5/33.

First :: Prev :: [...] [3] [4] [5] [6] [7] [...] :: Next :: Last


Tutti i nuovi CAP Italiani. Come ottenere il database completo