@# 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



Comments:

<0> 5.10 is getting a switch statement that isn't Switch.pm?
<1> Probably ... it's in the 5.9.3 Todo.
<2> Somni: yeah, it's getting a version of given() and smart-matching apparently
<0> haha, todo
<1> you have to enable it with
<1> use feature :switch;
<3> ternary is a godsend for tightening up boring conditional code
<1> (or :5.10 or :all)
<0> todo is a lick and a promise
<1> jdv79: truth
<4> i don't understand why a switch() hasn't been in perl before now
<0> because we get by just fine
<0> and a C-style todo is next to useless
<5> pravus: switch() accomplishes two things. First, it's syntactically concise. And second, because of restrictions on its form, the compiler can generate more efficient code than for an if-else tree.
<1> because Larry was carefully avoiding the C switch ...
<2> Somni: http://search.cpan.org/~rgarcia/perl-5.9.3/lib/feature.pm



<5> pravus: In Perl, you can get the concise syntax about a dozen different ways without introducing yet another special syntax. So that's not a good reason to put it in.
<4> yrlnry: but i like sugar. give me sugar!
<5> pravus: ANd in Perl 4, the compiler was clever enough to optimize if-else trees in the same way that C compilers usually optimize switches. So that was obviated too.
<1> Switch.pm is a Filter module, so it's dicey for Enterprise production code.
<3> dicey? how about a no-no!
<5> How about "doesn't work"?
<1> I was being polite.
<3> sometimes it does..
<5> Anyone can write a program that works sometimes.
<3> did Conway write it, by the way?
<6> Wtf, how do I get to Conroy Bumpus' house?
<5> sub square { return 289; } # sometimes works
<0> filter modules should be required by law to have in big bold letters that THIS IS A FILTER MODULE
<5> jdv79: Yes.
<3> i GUESSED
<3> wow...
<5> Somni: Perl6::Subs contains "This module is a source filter. Source filters always break."
<7> how do i add an array of pairs to an existing hash?
<5> ilpavox: %hash = (%hash, @pairs);
<7> ty
<5> that's the easy way.
<5> sure.
<8> how are filehandles scoped? global?
<9> can i create an alist that can store more than 1 thing
<1> Not all Damian modules are like that ... just the ACME:: and Filter modules.
<3> csb, the non-scalar ones, yeah
<2> e1f|shower: there's a kind that can't?
<1> csb: Depends ... if they're barewords, global, sadly
<9> i need an alist, keyed on messageid that can store the from and to email addresses
<1> csb: that's why modern $fh is better
<3> but modern perls let you use scalars and then they behave accordingly
<9> hobbs: i've only ever seen/used alists with 1 key and 1 datum
<3> with older perls you have to use some module like IO::File or IO::Handle or somehting but you can stil do it
<4> csb: are you writing a discertation on perl scoping?
<2> e1f|shower: er, what's an "alist"? I figured you just typoed "list"
<9> a hash, ***ociative array
<2> oh. hash.
<9> ***cciative list
<4> e1f|shower: perl has hashes... ***ociative arrays don't exist in the perliverse
<2> that last doesn't make any sense :)
<2> e1f|shower: in any case, just make each value of the hash an arrayref or arrayref that holds the data you want
<9> ok, i don't know how to do that, can you give an example?
<3> ***ociative arrays are hashes
<9> the key is msgid, and i need a from and a to for each msgid
<4> jdv79: but they don't exist in perl
<2> e1f|shower: I'd just be repeating perldsc
<3> "arrays indexed by a string"
<3> yeah, they do
<4> no.. they are called 'hash'
<9> perldoc -f perldsc will tell me?
<10> ...
<3> what's in a name anyway - c'mon
<2> e1f|shower: perldoc perldsc
<9> k, thanks
<2> e1f|shower: it's not a function
<9> oh, sorry
<3> %pravus = ();
<2> I don't know why you're sorry
<2> I'm just providing information
<4> yeah, pretty much
<9> i meant i'm sorry for starting the mini war



<9> i use the terms alist, ***oc. list and ***oc. array and hash interchangebly
<9> didn't realize it was a bone of contention
<2> e1f|shower: well the ones with "list" in the name are entirely wrong
<4> perl h4x use the term "hash"
<2> e1f|shower: the difference between a "list" and an "array" is similar to the difference between a "number" and a "scalar" :)
<4> the construct is given different monikers throughout the multiverse
<3> ok pravus:)
<4> jdv79: i am just nonsense... ignore me (as you probably already have)
<11> Why doesnt if($ARGV[1] == 'this') work?
<4> myconid: numeric comparison
<4> myconid: use eq instead
<12> myconid: try eq
<11> I did.. didnt work at all
<12> didn't match.. or gave an error?
<11> == always matches the first one
<4> myconid: script.pl blah this ?
<11> eq doesnt match any
<11> ./script this
<2> myconid: yes it does. Maybe you're just comparing to the wrong thing :)
<4> myconid: $ARGV[0]
<0> perl -wle '$ARGV[1] = "this"; if ($ARGV[1] eq "this") { print "yep, matched" }'
<2> myconid: maybe you're coming from C and didn't bother to find out how @ARGV is indexed
<11> thought ARGV[0] was the app name :)
<4> myconid: find a perl tutorial
<4> perl ne c
<11> pravus: because i forgot soemthing I never use :P
<11> thx for the help
<7> yrlnry: so putting a hash in list context as in %hash=(%hash, @array) actually spits out all the pairs?
<2> myconid: how thankful can you be if you can't afford the time to type 'thanks' in full? :)
<5> ilpavox: Yes.
<7> nice
<12> we demand proper appreciation!
<11> :)
<11> Thank you graciously.
<4> kp
<11> Question #2.. lets say I have a dataset.. primary key'd off social security numbers.
<9> i want a hash of arrays right? $hash{string}[2]
<11> And I want to import 50 more republicans into my blacklist
<2> e1f|shower: or a hash of hashes. It's a matter of style and of your data
<9> so each msgid hashed can contain 2 refs
<2> e1f|shower: either one would do fine
<11> but some of these 50 might already be in my database.
<11> is there a way to insert, or update if exists?
<4> myconid: you are talking about an RDBMS now?
<2> e1f|shower: you could also have $hash{$id}{from} and $hash{$id}{to}
<11> Yes
<11> I wish PHP could use DBI::Proxy
<4> myconid: without triggers/constraints, do a select
<13> hey all
<0> evening japhy
<4> japhy!
<13> two things: the "big fat phony" episode of Family Guy is on TBS right now...
<9> hobbs: hm. i see. i will make a note
<13> and WHAT THE HELL is with those stupid "Final Destination" movies?
<13> how could there be a third one? the plot is the same. it never changes.
<13> how was there even a second one?
<2> e1f|shower: a hash of arrays is marginally more efficient, but is it so big a difference that you should care about it? not likely
<12> it's a horror franchise
<2> e1f|shower: so like I said, style issue :)
<4> japhy: because you can avoid death >1 times?
<12> there's 12+ jason movies, all with the same plot
<0> the Final Destination movies are just vehicles for complex and unnecessary deaths
<2> ooh, death vehicle!
<6> AND YOU'RE COMPLAINING?
<6> Final Destination was freaking hilarious
<9> hobbs: don't much care for style, as long as it works
<0> they're actually pretty interesting if you just ignore the plot
<0> it's like porn that way
<4> death pr0n?
<12> cept porn is better
<9> have you guys seen the trailer for ultraviolet, aka fifth element 2?
<4> ++(++(++(++(++(++(++(++(++(++pr0n)))))))))
<13> SNAKES ON A PLANE
<6> e1f|shower: You seem confused. ultraviolet is equilbirium 2


Name:

Comments:

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






Return to #perl
or
Go to some related logs:

ex2ifs lvm
pyosg wx
how-to kopete spca
libdvdcss3
whats nabend mean?
[s-attrtab] Error 137
perc4e/di Dell drivers
#physics
+etch +QM_MODULES
unboiled potatoes of mine are fit to eat



Home  |  disclaimer  |  contact  |  submit quotes