― Jonathan Williams (ex machina), Friday, 8 November 2002 16:40 (twenty-three years ago)
― nathalie (nathalie), Friday, 8 November 2002 16:50 (twenty-three years ago)
C and Assembly is the true way.
― Mr Noodles (Mr Noodles), Friday, 8 November 2002 16:53 (twenty-three years ago)
― michael (michael), Friday, 8 November 2002 16:56 (twenty-three years ago)
― Sarah (starry), Friday, 8 November 2002 17:14 (twenty-three years ago)
― Jonathan Williams (ex machina), Friday, 8 November 2002 17:17 (twenty-three years ago)
― Sarah (starry), Friday, 8 November 2002 17:19 (twenty-three years ago)
― Mr Noodles (Mr Noodles), Friday, 8 November 2002 18:24 (twenty-three years ago)
― Jonathan Williams (ex machina), Friday, 8 November 2002 18:29 (twenty-three years ago)
― Dan Perry (Dan Perry), Friday, 8 November 2002 19:00 (twenty-three years ago)
― Mr Noodles (Mr Noodles), Friday, 8 November 2002 19:29 (twenty-three years ago)
― Jonathan Williams (ex machina), Friday, 8 November 2002 19:38 (twenty-three years ago)
(I wrote a quine once for a programming assignment, I sweated blood over getting it to be exact char-for-char and was very proud of it, and then the tutor went, "What is this gibberish? You were only supposed to call your source code 'bla' and get it to cat the file 'bla', you idiot." I don't know if he realised that it did actually display its own source code as the question requested, I suspect he thought it was just a mass of random junk. Weep.)
ANYWAY, I am getting really smug and proud about being pitiful clueless dozeluser now, it might mean that nobody will give me a job and it might be crushing to admit that not only am I too nerdy to integrate into normal society but that I am entirely shit at the only thing I ever thought I might be any good at and no geeks want to know me either (and most of them are better with Real People too), but at least I'm not as tiresomely sanctimonious as some of the rabid linux advocates I've had to endure bitching through their 1337th conversation of the day about IP ranges, car engines or how k-rad they are for getting linux to run on a really shit old computer but how they really need to buy the newest shiniest most expensive gadgets out there anyway.
Although - on the strength of this post alone and in general too - I am pretty damn tiresomely sanctimonious and bitchy and I'm getting worse every day so, uh, please, please, someone kill me soon. (Yes, indie sceeeenes make me feel the same way too; no, quoting records on Teenbeat doesn't mean that any of them want anything to do with me either, and I can't even go, "oh well, they're all beardy and scary loners so NER," because, well, they aren't, but look at me. No, don't, it makes me nervous. Shyly coy and nervous, get in the sli*BANG* *innards spray everywhere*)
― Rebecca, mixing like a monkey, don't be coy and jumpy (reb), Friday, 8 November 2002 20:06 (twenty-three years ago)
Perl is all very well at what it does, but is such an ugly, nasty kludge it makes Fortran 77 look like a sensibly designed language in comparison. Haskell smacks down ML variants in any fite ever as well(if I'm refereeing anyhow)
― RickyT (RickyT), Friday, 8 November 2002 23:40 (twenty-three years ago)
R3PR4Z3|\|T.
PS J0R /-\LL 0\/\/|\|3|)
― N0RM4N PH4Y, Friday, 8 November 2002 23:58 (twenty-three years ago)
― N0RM4N PH4Y, Saturday, 9 November 2002 00:00 (twenty-three years ago)
― N0RM4N PH4Y, Saturday, 9 November 2002 00:02 (twenty-three years ago)
I often think of *xn*tters who might enjoy Ask A Drunk (I assume M Morris, whose return I was pleased to see, has been on both), and I was tempted to link from the euphemisms thread to the f*ce p*jama page, but then I remembered how scared I'd be if anyone of the people I was thinking of actually did turn up.
I will not be ontopic, dammit. Otherwise I will remember either that there's a very simple perl script that I should've done months ago and haven't and now I can't remember all the very basic perl I learnt last time or how much I hate my ex and his perl t-shirts and the fact he's probably infinitely happier than I am at any given moment. [Talking of obfuscated languages, someone needs to write a syntax-highlighting either-or matcher for my posts, they must be unreadable.]
(Though I have been quoted on perl mailing lists, hahaha. But unsurprisingly not for perl gurudom, just an offhand moment of angst that bizarrely and embarrassingly ended up in a proper perl guru's sig.)
― Rebecca (reb), Saturday, 9 November 2002 00:20 (twenty-three years ago)
PH34R TEH N0RM4N SK!LLZ... PH4Y R0X0RZ J00R PUNY B0X3N, F3WLIOZ~$%^*)~
Erm, yes. Where was I? w00t, an' all that.
― Rebecca (reb), Saturday, 9 November 2002 00:27 (twenty-three years ago)
― RickyT (RickyT), Saturday, 9 November 2002 01:09 (twenty-three years ago)
― Dave Fischer, Saturday, 9 November 2002 01:24 (twenty-three years ago)
R, I know what you mean about *xn*tt*rs and FAD. I'd be verrrry worried about any of the pedant mob turning up here, even if a C*l*n B*tch*l*r versus combined mass of ILX intellect might be v.funny.
― RickyT (RickyT), Saturday, 9 November 2002 01:38 (twenty-three years ago)
As for "the greatest", well, I do like C. I'm not too familiar with x86 Assembler, but 6800 assembler is pretty nice. (I wrote a Nintendo game with it once) Whoever said Haskell is good in any way should perish in a firey inferno. I'm a firm believer that you're only pitiful if you can't pick up whatever language you need to do the job.
Rebecca, knowing that you're a) female, b) able to code, and c) able to code in Brainfuck, makes you extremely attractive. To me at least. God, I suck.
― Andrew (enneff), Saturday, 9 November 2002 02:13 (twenty-three years ago)
― RickyT (RickyT), Saturday, 9 November 2002 02:28 (twenty-three years ago)
Not only that, but you have to do mental hurdles to put yourself into the 'Haskell Mindset' - procedural/imperitive/oo languages more closely mirror my mental process.
― Andrew (enneff), Saturday, 9 November 2002 03:26 (twenty-three years ago)
Somehow I suspect "occasionally taking about 300 times longer than should be necessarily to kludge together broken Visual Basic and running in fear from real languages" doesn't sound very attractive at all. In fact, I have yet to think of anything about me that does. But why do I correct people who'll never meet me anyway? Ahem. YES I am the world's greatest and not a feeble braindead dropout who can't get a job at all. I am also stunningly beautiful and fascinating and fun to be around, which is why my entire life consists solely of sitting around all alone boring people to death on the internet. Mmm CATCH.
― Rebecca (reb), Saturday, 9 November 2002 03:32 (twenty-three years ago)
― ron (ron), Saturday, 9 November 2002 03:35 (twenty-three years ago)
― Rebecca (reb), Saturday, 9 November 2002 03:45 (twenty-three years ago)
'grok' means 'understand', basically.
― Andrew (enneff), Saturday, 9 November 2002 04:44 (twenty-three years ago)
― Queen G (Queeng), Saturday, 9 November 2002 10:02 (twenty-three years ago)
I am also stunningly beautiful and fascinating and fun to be around
At least two of these are true.
― Graham (graham), Saturday, 9 November 2002 15:04 (twenty-three years ago)
why can't i be a master programming genius? why why why why why???
― sand.y, Saturday, 9 November 2002 21:29 (twenty-three years ago)
― RickyT (RickyT), Saturday, 9 November 2002 22:44 (twenty-three years ago)
(For those who don't already know: programming is a significant part of my job, too, but I am not fool enough to think it makes me cool.)
― Martin Skidmore (Martin Skidmore), Saturday, 9 November 2002 23:17 (twenty-three years ago)
Sod off. If ilxor was written in Haskell, the server would have keeled over and died a long, long time ago. The efficiency benefits of Assembler over C are quite small, whereas those of C over Haskell are massive. Just out of interest, what do you actually use Haskell for?
― Andrew (enneff), Sunday, 10 November 2002 02:00 (twenty-three years ago)
― Graham (graham), Sunday, 10 November 2002 20:58 (twenty-three years ago)
"Bloody build processes!"
er
"I really think I am being underpaid!"
"ERROR REDO FROM START!"
Back to the photocopying then.
― Sarah (starry), Monday, 11 November 2002 10:31 (twenty-three years ago)
― kingfish maximum overdrunk (Kingfish), Wednesday, 18 May 2005 04:04 (twenty years ago)
― lyra (lyra), Wednesday, 18 May 2005 04:24 (twenty years ago)
― kingfish maximum overdrunk (Kingfish), Wednesday, 18 May 2005 04:29 (twenty years ago)
― Ed (dali), Wednesday, 18 May 2005 05:03 (twenty years ago)
― kingfish maximum overdrunk (Kingfish), Wednesday, 18 May 2005 05:22 (twenty years ago)
m.
― msp (mspa), Wednesday, 18 May 2005 05:22 (twenty years ago)
not if you have active state installed, you can just run it locally. i learnt perl on my win98 box. (or doesn't windows come with a command line anymore?).
(i'd install cygwin so at least you don't have to suffer the dos command line)(i'd also learn php rather than perl, you still have all the associative arrays and stuff but the syntax is easier)(the other big problem that i've seen people have with all this stuff is knowing how to edit files (using text editor, not some wysiwysg thing) and where the files actually are (because windows abstracts this too much, encourages you to stick them all on the same disk as the operating system = madness))
― koogs (koogs), Wednesday, 18 May 2005 06:59 (twenty years ago)
If you really want a shell account and don't want to set up and administer a linux box yourself (not too hard, but securing it at the start can be a bitch), I'll recommend itshosted.com -they provide web hosting space, but you can get ssh access to it and goof around. The big advantage then is that they have to worry about all the security patches, not you.
― lyra (lyra), Wednesday, 18 May 2005 13:23 (twenty years ago)
cygwin + active state perl are a bit iffy together if i recall. path issues perhaps? active state perl wanting windows paths and cygwin bash wanting *nix style paths. use google and double check before you pull your hair out. if i'm on my xp box, i usually just use the dos command line. it sucks, yes, but sometimes you do what you have to do. i run fedora on another machine, but it's cumbersome sometimes to have to use remote tools, etc. (yeah yeah yeah, i know there are a gajillion work arounds like samba+ssh... if i spent more time hackin perl i might care.)
my personal top 5 favorite (aka most used) perl things to know:1. regular expressions and those sed/awk like operators2. hashes and lists and combinations of those two things (LoL and HoL and LoH, etc etc)3. split/join/string manip functions4. HEREDOCUMENTS5. pushpopshiftunshiftsplice array manip fuctions
i use all of those things in almost every perl script i write.m.
― msp (mspa), Wednesday, 18 May 2005 13:50 (twenty years ago)
Doesn't cygwin come with its own version of Perl anyway? It's probably not in the default install, but I think it's in there somewhere.
― caitlin (caitlin), Wednesday, 18 May 2005 14:12 (twenty years ago)
the only reason i like here docs is that if you've got extensive text to output, it's so much more trivial than a ton of prints, so much more efficient than string building, etc etc.
but yeah, probably the biggest source of errors ever.
i'm curious tho, any suggestions for handy ways not to use here docs? if there's a wiser solution, please share.m.
― msp (mspa), Wednesday, 18 May 2005 14:25 (twenty years ago)
― Gravel Puzzleworth (Gregory Henry), Wednesday, 18 May 2005 14:28 (twenty years ago)
The main reason I don't like them, I guess, is that they mess up the auto-formatting in Emacs Perl mode. See also: output formats (which I've generally found more useful, but have the same problem).
― caitlin (caitlin), Wednesday, 18 May 2005 14:28 (twenty years ago)
Assigning an array to an int: not useful.
Assinging an array to a pointer: very useful.
(YES I KNOW INT[] IS ACTUALLY INT*)
Stop talking crap then.
― Forest Pines (ForestPines), Thursday, 21 July 2005 06:30 (twenty years ago)
I'm trying to stop using $#array for two reasons:
a) I can never remember which is less, $#array or scalar @array. Just dealing with one will make life easier.
b) I'm trying *now* to stop using syntax that's not in Perl6. $#array is going.
Well what else would it do? How can you convert an array to a scalar?
Returning the number of elements seems obvious with hindsight. It's not, though. Why should scalar @array return the length and not the highest valid index like $#array does? If you're coming from C/C++, returning an array reference would be the obvious implementation. For that matter, why shouldn't scalar @array do the same as scalar %hash?
― Forest Pines (ForestPines), Thursday, 21 July 2005 06:34 (twenty years ago)
C is good for learning more how a computer does things, like they said, it's little more than a bunch of functions on top of assembler. that said, sometimes you don't need to know how a computer does things. which is why its less fashionable these days (and why i see a lot of people brought up on java having trouble with, say, bitwise operators). C's lack of standard stuff like hashes and vectors annoys me though (although gnu libraries help)
if you know perl but want to write 'applications' then have a look at tk/tcl which basically lets you get stuff on screen (windows, file choosers etc) and has a perl binding. failing that i'd say java (which is transferable to other machines) or objective c. (is glade available on mac?)
― koogs (koogs), Thursday, 21 July 2005 07:36 (twenty years ago)
is glade available on mac?
Probably, but I wouldn't like to say so for sure. Given that GTK works and libxml (presumably) works, I don't see why not.
― Forest Pines (ForestPines), Thursday, 21 July 2005 07:43 (twenty years ago)
mono / gtk# / glade on a mac
― koogs (koogs), Thursday, 21 July 2005 09:43 (twenty years ago)
Rule #1 of good coding: don'to optimize (yet)
The compiler knows enough to turn mult and div by powers of two into bits shifts.
(Yes I know there are other reasons to use them, but I see this all the time.)
― OLD SPICE® CHEMTRAILS!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (ex machina), Thursday, 21 July 2005 10:48 (twenty years ago)
― OLD SPICE® CHEMTRAILS!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (ex machina), Thursday, 21 July 2005 10:49 (twenty years ago)
I'll put it this way- if you care about that infimestimal speed difference, you're on the wrong language. Even mod_perl is slow as all get out. When you need things super fast, go use C. But when you're writing web apps, you can get away with perl, because the slowness of using perl is tiny compared to the time to make the http requests. If you're using a mod_perl server on a well tuned apache web server, you'll be fast enough in comparison to the time to travel over the network.
don't you mean:die "sorry sucker i died on you";
Not really- I use eval when I suspect something might die on me, but I don't want the whole webpage/perl script to be taken down by it. So I'd throw a warning that something isn't available and then carry on. There's not too much of a point in catching dies in evals and then dying yourself right after- even if you want a custom _DIE_ handler, you can just overload that directly & save yourself the trouble of eval'ing.
― lyra (lyra), Thursday, 21 July 2005 14:38 (twenty years ago)
― lyra (lyra), Thursday, 21 July 2005 14:40 (twenty years ago)
― OLD SPICE® CHEMTRAILS!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (ex machina), Thursday, 21 July 2005 14:51 (twenty years ago)
― OLD SPICE® CHEMTRAILS!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (ex machina), Thursday, 21 July 2005 14:52 (twenty years ago)
― lyra (lyra), Thursday, 21 July 2005 15:04 (twenty years ago)
― OLD SPICE® CHEMTRAILS!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (ex machina), Thursday, 21 July 2005 15:11 (twenty years ago)
― k/l (Ken L), Wednesday, 10 August 2005 17:16 (twenty years ago)
Perl5 is in C, at least. Perl6 might be in C++; I'm not 100% sure on that.
― Forest Pines (ForestPines), Wednesday, 10 August 2005 17:18 (twenty years ago)
Apparently it's sparked a lot of interest in Haskell. Just thinking about it breaks my brain a little, since I thought of a number-crunching mini-task to throw together in Hugs recently, until after 20 minutes and much garbage collection and not very many iterations I decided to do it in perl, which gave me an answer in a split second. My fault for not thinking about efficiency, sure, but... well, ouch.
Oh yeah, the more official perl 6 development work is on the Parrot project, which I think is still written in C, but it's at this point that I stop even being able to pretend I know what I'm talking about, and I only wanted to mention the Haskell thing to amuse and horrify the people here who've used it.
― Rebecca (reb), Wednesday, 10 August 2005 20:23 (twenty years ago)
― Rebecca (reb), Wednesday, 10 August 2005 20:27 (twenty years ago)
What is the difference between: ($thing) = @_and $thing = @_ ?
― Gravel Puzzleworth (Gregory Henry), Saturday, 15 April 2006 19:41 (nineteen years ago)
― Fight the Real Enemy -- Tasti D-Lite (ex machina), Saturday, 15 April 2006 19:51 (nineteen years ago)
― Gravel Puzzleworth (Gregory Henry), Saturday, 15 April 2006 19:56 (nineteen years ago)
― Gravel Puzzleworth (Gregory Henry), Saturday, 15 April 2006 19:59 (nineteen years ago)
― shieldforyoureyes, Sunday, 16 April 2006 12:37 (nineteen years ago)
You have #1 right, but a clearer answer would be: it behaves the same as $thing = $_[0]
#2 is wrong; $thing isn't a list. It assigns the length of @_ to $thing, because the left-hand side puts the expression into scalar context. You're thinking of $thing = \@_
― Forest Pines (ForestPines), Sunday, 16 April 2006 13:56 (nineteen years ago)
― Forest Pines (ForestPines), Sunday, 16 April 2006 13:59 (nineteen years ago)
― the unbearable lightness of peeing (orion), Sunday, 16 April 2006 16:22 (nineteen years ago)
― Casuistry (Chris P), Sunday, 16 April 2006 16:58 (nineteen years ago)
http://www.ozonehouse.com/mark/blog/code/PeriodicTable.png
― mikef (mfleming), Sunday, 16 April 2006 17:21 (nineteen years ago)
Another question: how clever is perl about $_? Like, if I have an implicit for loop, and I call a sub from it, presumably the sub can't have anything that alters $_ in it, such as another implicit for loop?
― Gravel Puzzleworth (Gregory Henry), Sunday, 23 April 2006 18:17 (nineteen years ago)
― Gravel Puzzleworth (Gregory Henry), Sunday, 23 April 2006 18:27 (nineteen years ago)
As to the first question: yes, you can, in that case. This is because foreach loops are special (I assume you meant foreach rather than for, because for doesn't use implicit $_) in that the iterator returns to its previous value after the loop is finally exited.
― Forest Pines (ForestPines), Sunday, 23 April 2006 18:46 (nineteen years ago)
― Tracey Hand (tracerhand), Sunday, 23 April 2006 18:51 (nineteen years ago)
― Forest Pines (ForestPines), Sunday, 23 April 2006 18:51 (nineteen years ago)
-- Gravel Puzzleworth (mostlyconnec...), April 23rd, 2006 8:17 PM. (Gregory Henry) (later)
but doesn't passing parameters to a sub already alter $_? Or at least @_? -- Gravel Puzzleworth (mostlyconnec...), April 23rd, 2006 8:27 PM. (Gregory Henry) (later)
Passing parameters only alters @_, not $_ As to the first question: yes, you can, in that case. This is because foreach loops are special (I assume you meant foreach rather than for, because for doesn't use implicit $_) in that the iterator returns to its previous value after the loop is finally exited.
A
-- Forest Pines (il...), April 23rd, 2006 8:46 PM. (ForestPines) (later)
You're just playing a geekx0r version of Mornington Crescent, aren't you.
― Markelby (Mark C), Sunday, 23 April 2006 20:01 (nineteen years ago)
It could be worse - Perl really does have some bizarre hidden corners.
― Forest Pines (ForestPines), Sunday, 23 April 2006 20:06 (nineteen years ago)
― jinx hijinks (sanskrit), Sunday, 23 April 2006 20:34 (nineteen years ago)
― JW (ex machina), Monday, 24 April 2006 03:12 (nineteen years ago)
I'm guessing this should be simple for someone who actually knows perl (i.e. not me): I'm trying to search a string like this:
blah blahblahblah blahblah 1.1&1.8&2.5&3.3blah blah
― Leee, Thursday, 12 July 2007 21:37 (eighteen years ago)
end your regexp with /g for all matches
http://perl.active-venture.com/pod/perlretut-usingregexp.html
alternatively split on & then check each of the results?
― koogs, Friday, 13 July 2007 10:37 (eighteen years ago)
Smalltalk 4evah!
― anatol_merklich, Friday, 13 July 2007 11:02 (eighteen years ago)
New question. I've built a database of documents that includes past versions, e.g.:
Doc001 document description V0.1 Doc001 document description V0.2 Doc001 document description V1.0 Doc002 document description V0.1
(Tab-delimited.)
However, I sort each line in the list as a string, so when the document description changes, it can alter the order of the documents like so:
Doc001 dacument description V1.0 Doc001 document description V0.1 Doc001 document description V0.2
Do I need a hash? I'm not very good with those.
― Leee, Tuesday, 2 October 2007 23:48 (eighteen years ago)
It's not so much that you need a hash as that you need a data structure of some sort. And yes, in Perl, hashes are pretty much the the data structure, especially when dealing with string and numerical data. You'll probably need a few foreach() loops to unwind the data in preferred order, coupled with sort, and so on.
If you have a huge amount of data, then the right thing to do is probably to ASCII-encode the data with fixed-length fields so that the sort order corresponds with ASCII order.
― libcrypt, Wednesday, 3 October 2007 00:18 (eighteen years ago)
OK this one hopefully has a quick and easy answer.
I have a hash of arrays of hashes, e.g. a bunch of data of a bunch of people. The first classifying criteria is gender. Each gender is an array of entries, with each entry including multiple key/value pairs (female #124: height, weight, bust size, etc.). How do I figure out how many women and how men are in the list -- without using loops?
― Leee, Wednesday, 30 April 2008 20:35 (seventeen years ago)
Use loops. This ain't no relational data structure, dude.
― libcrypt, Wednesday, 30 April 2008 20:55 (seventeen years ago)
$count = scalar keys %hash;
― f. hazel, Wednesday, 30 April 2008 21:11 (seventeen years ago)
I kind of hate sigils in Perl. Ruby's sigil's as explicit scoping is better imo
― Catsupppppppppppppp dude 茄蕃, Wednesday, 30 April 2008 21:22 (seventeen years ago)
Hm, I forgot about the scalar function and am now wondering if it's bad form to throw in an explicit call to scalar to stop future generations scratching their heads at a particularly inscrutable (to the non-perl-grokker like the coworker most likely to need to change the script in a hurry) implicit forcing of scalar context.
(Or I could just write two lines of comments, or turn 1 line of code into 3 with needless intermediate variable)
― a passing spacecadet, Wednesday, 30 April 2008 21:46 (seventeen years ago)
Hi again. I'm parsing a text file for certain keywords (let's call them "alpha," "beta", "gamma"), and for convenience sake, I use a local hash to hold those parameters. (E.g. $hash{alpha} = some value.) I want all of these parameters to be defined before I return from the subroutine, so I have
while ( !(defined $hash{alpha}) or !(defined $hash{beta}) or !(defined $hash{gamma}))
But now, depending on certain conditions, I might want to look for additional keywords (e.g. "delta", "epsilon"). Assuming I initialize all these keys to undef before I enter the loop, is there an expression I can use for the while condition that basically sez "Keep looping until all existing keys are defined"?
― Leee, Tuesday, 25 November 2008 23:28 (seventeen years ago)
http://pastie.org/324034
― J0hn D., Tuesday, 25 November 2008 23:46 (seventeen years ago)
Actually figured it out myself; I stored the scalar of the keys in a $num_keys, then
while (scalar grep { defined $hash{$_} } @keys < $num_keys)
― Leee, Wednesday, 26 November 2008 04:04 (seventeen years ago)
New one: I'm trying to write my own Mysql module that extends DBI and DBD::mysql. My custom connect() method works fine, but when I try to write a query() method that takes care of both methods in DBD::mysql -- e.g. prepare() and execute() -- I get a compiler error saying that it can't find the prepare method. Is there something weird going on with DBD::mysql that makes it more involved to extend?
― Daleks in NYC (Leee), Tuesday, 15 June 2010 22:43 (fifteen years ago)