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



Comments:

<0> so about the functions, here's an example http://paste.ubuntu-nl.org/8093
<1> Guido is into S&M, and he wants to share it with his developers
<0> the variable 'line' is a string
<0> anyone know how to duplicate that in perl?
<2> perldoc -f tr
<3> The perldoc for tr is at http://perldoc.perl.org/functions/tr.html
<0> that page wasn't very helpful
<2> no. follow the perlop link and search for tr/ :)
<4> tr// is evil
<4> pianoboy3333 : what does the line do?
<5> http://sial.org/pbot/15763
<5> is there a nicer way of doing something like that?
<5> its a lot of code to just influence the ordering a bit
<0> line would just be a string that would hold an already encoded file and turn it into regular english
<4> is ist some rot13 stuff ?
<4> it*



<4> well, that is one of those things tr// can do very nicely..
<0> with tr, can u use like () instead like u can with qw?
<6> Can anyone help me using the "curl" command? I'm trying to automate a web form and am having a problem p***ing one of the fields...
<7> Kury: your problem has nothing to do with perl, and probably nothing to do with the curl command, and repeating won't help you anyway :)
<6> I figured it was probably a general web/form thing... and that someone here might know the answer...
<8> if i have an n by m matrix, how do i get the list matrix[All][0]?
<6> Any suggestions where else I might check for an answer?
<7> Kury: well then you could at least ask the question you really meant instead of just being confusing :)
<4> pianoboy3333 : yes
<7> adu: map {$_->[0]} @matrix
<0> tmlsd: but can i have a varible equal to a tr// statement? like $str1 = tr/asdfjkl/ ?
<7> pianoboy3333: you can -- as long as you want to know how many characters were substituted while running tr on $_ ;)
<0> tmlsd: and then $str2 =~ $str1 ?
<6> here is the webpage and... what I have been p***ing to curl.. http://marvin.ibest.uidaho.edu/~heckendo/CS445/submitTar.html
<6> curl -d "cl***=445&student=cone&***num=445%20***ignment%201" http://marvin.ibest.uidaho.edu/~heckendo/cgi-bin/hwSubmitTar.cgi
<9> Kury's url is at http://xrl.us/jvo8
<9> Kury's url is at http://xrl.us/jvo9
<6> its the ***num field that isn't working for crap..
<10> eval $str1 for $str2;
<0> tybalt89: and that'll do it?
<10> perlbot: tias
<11> Try It And See: the best way to learn if something works.
<0> tybalt89: but will that change $str2? or $str1 ?
<10> what happens when you try it?
<4> you use tr/// like s///, but of course it works different.. No regexp involved.
<4> tr/// has some 2-3 own, specific switches, that I never can remember what do..
<12> yeah so the problem is that the form requires multipart
<6> doug: no.. thats not the problem I'm dealing with..
<6> I know how to do that...
<4> Kury : have you considered using www::mechanics?
<4> then its piece of cake
<13> I think you'll find it's WWW::Mechanize
<6> ya... but I have to use curl.. and run it on a system that I don't have root access too... and it doesn't have perl or the www::Mechanize add on
<4> haha, ye..tired..
<14> perl without root or at least compiler and shell is no fun
<15> whats a good book to buy to learn perl
<7> Learning Perl
<5> so, anyone?
<15> and after that what else can i use to advance on that
<5> I know there's people in here better than I am that would know
<7> sasha2: loads of things.
<4> could u tell what that code is to do, jdv79 ?
<7> perlbot books > sasha2
<6> All of the Orielly perl books are great books...
<4> ugh my english..
<5> it is to influence the ordering of @$things with the entries in @$order
<15> thanks
<4> be more specfic
<4> specific*
<5> i have a feeling there's a better way overall cause this feels like i'm reaching
<4> there is always a better way.
<7> jdv79: the goal is just that any items of @$things that are mentioned in @$order have to appear in the same order relative to each other as they do there?
<7> jdv79: and anything else in @$things is irrelevant to order?
<5> lets say i have a list ( a,b,c,d) but i want d to come before b so I setup another list (d,b) to use in the ordering
<5> hobbs, yes, we're somehow on the same page
<5> that's all
<7> jdv79: should "not mentioned" things be guaranteed to keep the same order relative to each other that they already had? (I.e. it's sort of "stable")?
<5> i suppose - the order in the app is just sort, but then after that i want to be able to force some relative orderings
<16> anyone know of a psuedo-random number generator that can generate random numbers that result in a bell shaped histogram with a target mean median and standard deviation?
<6> ... doesn't sound all that random..
<7> simcop2387: Math::Random::OO apparently



<7> Kury: sure it is
<7> simcop2387: though you could take any generator and apply a fairly simple function to it to normalize it, I'm sure
<5> hobbs, its just a curiosity of mine whether or not my solution is decent
<7> jdv79: yeah, I gotcha. I think it could be done better, but I can't quite make it come together :)
<7> jdv79: perl's sort() is stable, which I think can be used to your advantage
<16> hobbs: cool, i didn't know one already existed, damn #perl has too many random experts on random topics, if we got together we could solve fermats last theorum
<7> jdv79: invert @$order into a hash, so that [qw(E A C)] becomes {E=>0, A=>1, C=>2}
<7> jdv79: write a function that takes any item and returns its value in that hash if it's there, and -1 if it's not
<7> jdv79: then use sort() on @$things with a sub that compares those values (with schwartz if you like)
<7> simcop2387: I've never used it, but I remember seeing it -- so I just used cpansearch to refresh my memory :)
<7> jdv79: I think that ought to do it :)
<16> heh
<4> hobbs : thats a nice solution.
<7> jdv79: Well, I don't know if it does exactly what you want, but it should be a starting point. It might be improved by having the sort sub return 0 if either element is not present in @$order
<5> we'll see - i'm checkin it
<7> jdv79: as it is, it'll shuffle any "not mentioned" things to the beginning of the list, which doesn't exactly go against what you said, but doesn't match your example either
<5> not with the zero returning version, right?
<7> right
<5> that's good
<7> that'll leave those items somewhere in the vicinity of where they were
<5> the only effects i want on the list are the least required to satisfy the order in @$order
<7> right, that addition should make it do that. As long as sort() performs how I expect it to
<7> but TIAS, I haven't written any code whatsoever :)
<16> hobbs: thanks looks like thats about exactly what i've wanted (doesn't do median also but oh well, normal curves are fine for me)
<7> I'm just helpful all around today
<7> er, FFVII
<17> @listfiles = grep { // } readdir(DIR);
<17> would that grab subdirectories too?
<17> or just files?
<18> Cryptic_K: what's the point of that grep?
<7> Cryptic_K: depends what you mean. It lists everything that's in the directory pointed to DIR; files, directories, and miscellaneous things
<7> it does _not_ list things that are inside subdirectories of that directory
<19> TIAS is always a good idea for simple things.
<7> jdv79: If you make it fly, would you mind pastebotting it for me? :)
<17> hobbs, how do I check if something within @listfiles is a directory?
<17> Paladin, nothing.
<7> Cryptic_K: with -d of course
<17> I forgot to change it
<18> Cryptic_K: perldoc -f -X
<3> The perldoc for -X is at http://perldoc.perl.org/functions/-X.html
<20> Hi, why isn't this oneliner: perl -e 'sub test { print "hi\n" } %h = { bleh => \&test }; print $h{bleh} . "\n";' giving output like: CODE(0x814b618) ?
<19> "perl is an empirical science" :)
<17> Ah
<5> i'm fighting with myself atm
<17> Thanks Paladin
<5> surely
<20> If I print \&test directly I do get that output form
<21> locsmif, why are you ***igning a hashref to a hash?
<8> jdv79: hope you win!
<20> hawkaloogie, oops
<7> when jdv79 fights himself, everyone loses
<18> locsmif: { } creates an hashref, use ()
<5> uh, thanks guys
<20> hawkaloogie, that was the cause :S
<20> Paladin, yup, ty :)
<22> jdv :)
<7> ology: ain't that the truth
<17> hobbs: foreach my $x (@listfiles) { $files++ unless -d $x; $directories++ unless -f $x;
<17> }
<17> why doesn't that work? :\
<17> it counts them as the same
<17> apparently
<4> I could kill YOU for a smoke.
<7> Cryptic_K: probably because "$x" is the name of a file that's not in the current directory
<13> tmlsd - No you couldn't. We'd run away, you'd try to catch us, but you'd run out of breath.
<4> : )
<4> maybe
<7> Cryptic_K: make the path absolute (preferably using File::Spec->catfile, but with "$dir/$file" if you must)
<20> hawkaloogie, actually I want to create two tables of references to subroutines, and ***ign either of those tables to a hash (or possibly something else if that's better) depending on some preceding condition.
<16> eval: system("sudo /sbin/halt");
<17> hobbs, agh
<17> Hrm


Name:

Comments:

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






Return to #perl
or
Go to some related logs:

fedora disk mounter not privileged mount floppy
#debian
#gentoo
mysql error 2013 from_unixtime
Closing Link: 127.0.0.1 (Connection timed out) help
#javascript
#lgp
mysql give root access
para unjumble
configuring tightvncserver



Home  |  disclaimer  |  contact  |  submit quotes