• dkf (unregistered) in reply to Daniel
    Daniel:
    Smitty:
    What the hell is wrong with $filesize = size_on_disk(filename)
    Well why not filesize($file), or size_of_file($file) etc etc.
    You do realize that they're different things, strictly? The size of a file on disk is typically rounded up to a number blocks (often a power-of-two number of blocks), but the file might also be sparse, which would would reduce the size on the disk without changing the size of the file...

    Yeah, yeah. Pedantic. Writing specifications does that to you.

  • Nah (unregistered) in reply to Axit
    Axit:
    jtwine:
    >That is the beauty of C++ - you get C's stuff with it. :)
    And by far it's greatest weakness.

    The RWTF is not knowing the difference between "it's" and "its".

  • (cs) in reply to dkf

    I also like that the original code doesn't even work for files less than ~ 1 meg. Take "crap.txt", a roughly 5kb text file:

    wc -c crap.txt | cut -c0-8 | sed 's/ //g';

    9112cra

    WTF, indeed.

  • diaphanein (unregistered) in reply to anne
    anne:
    am I totally weird for loving perl AND bash?

    Yes.

  • Daniel (unregistered) in reply to dkf
    dkf:
    You do realize that they're different things, strictly? The size of a file on disk is typically rounded up to a number blocks (often a power-of-two number of blocks),

    Hah yes, I'm aware of that, but I was trying to make a simple point with out complicating things :)

    Although I didn't think the size of the file on disk was just "rounded up" to some block size as a power of two... I thought that was because files are assigned blocks on disk (what ever that block size happens to be) whether or not the file uses it. That is, if the block size is say 512 B but the file only needs 128 B, it's size on disk is still 512 B? Meh I don't know, I'm tired and rambling. And would love some captcha. I mean waffles.

  • Marcin (unregistered)

    Hold on...does PERL not have an easy way to destructure the output of commands into variables? (I mean to parse it very simply into a bunch of variables, then select the contents of the required variables)

  • Anonymous Coward (unregistered)

    fhiting!

  • David Hasselhoff (unregistered) in reply to DocJowles
    DocJowles:
    I also like that the original code doesn't even work for files less than ~ 1 meg. Take "crap.txt", a roughly 5kb text file:
    wc -c crap.txt | cut -c0-8 | sed 's/ //g';

    9112cra

    WTF, indeed.

    Anyway the right way to do it is : wc -c filename | awk '{print $1}'

  • (cs) in reply to Alex G.
    Alex G.:
    Bleh. That's what happens when you force some guy who does bash to do Perl.
    No, it's what happens when you get a guy who's clueless.
    $filesize = `stat -c %s /vmlinuz`
    
    Don't have stat? One less operation in the pipeline.
    $filesize = `wc -c /vmlinuz | cut -d ' ' -f 1`;
    
    Can't do that?
    # parens around $filesize are important here. read up on scalar vs list context.
    ($filesize) = (`wc -c /vmlinuz` =~ /^(\d+)/);
    
    I could do this all day.
    # perldoc -f stat
    $filesize = (stat('/vmlinuz'))[7];
    

    look ma! no stat or piping!

    $filesize = do {open(my $f, '<', '/vmlinuz'); seek($f, 0, 2); tell($f) };

    OK, enough of that. I previewed my post; I love how the forum software double-spaces my stuff.

  • riaa (unregistered) in reply to Daniel
    Daniel:
    Smitty:
    How would one EVER guess that the supplied code solved that problem.
    If you're guessing while programming (or scripting, what ever), then you should probably think about doing something else.
    Smitty:
    What the hell is wrong with $filesize = size_on_disk(filename)
    Well why not filesize($file), or size_of_file($file) etc etc. That doesn't solve the problem, it just makes it "easier" in your happy little hypothetical world.
    WTF are you on, yes, any set of words that describe what is going on instead of a letter is better.

    Pretend for a moment you inherit an application in a language for which you only have a basic understanding. Which is going to make it easier to read:

    filesize = -s filename filesize = filename.size ?

  • smile (unregistered) in reply to ElQuberto
    ElQuberto:
    I was really shocked to read it until I started programming in Java and saw that's the way you do it.
    Someone should consider learning a little about a language before commenting on it.
  • (cs) in reply to Oliver Klozoff

    Those who know Perl in the pre-5.0 days are familiar with the -X stat operators. We should probably stop using them because they aren't very communicative and are only good for quick hacks and shell scripts that no one will maintain.

    This was fixed years ago. The way it should be done:

     use File::stat;
     $st = stat($file) or die "No $file: $!";
     print "The size on disk of $file is " . $st->size . " bytes\n";
    
  • (cs) in reply to gilleain
    gilleain:
    edit : also, as for the timing - 75 mins is quite a big improvement no matter how long the program takes. I mean no program is going to take 20,000 hours is it? So 75 mins must be quite a chunk of time.

    Even if the program takes 24 hours to run, 75 minutes is still a huge improvement. If it takes more than 24 hours to run...why are they using Perl?

    Of course, they must be making a ton of file size calculations in that time to make the change that significant. If the piped method takes .01 seconds (which is a drastic overestimate), and the perl "-s" method returns instantly, then 75 minutes difference means they looked up a file size 450,000 times while executing this perl script.

  • Tyler (unregistered) in reply to Smitty
    Smitty:
    Oh, I get it, that's what makes perl so 'powerful', it's non-intuitive use of shorthand whenever and wherever possible.

    How would one EVER guess that the supplied code solved that problem. Where would you look to find the '-s' operator (or whatever perl twinks call it.)

    What the hell is wrong with

    $filesize = size_on_disk(filename); or some equally intuitive and easily remembered (or guessed) function name ?

    perl sucks - get over it.

    You would not have to guess. You would read "perlfunc", which is the Perl function list, and you would find it under "Functions for filehandles, files, or directories".

    Gee that's hard.

  • Misha (unregistered)
    my @dirs = `ls -1 $path`;

    I did that once and thought it was a dead clever way to save 3 lines of code. In fairness, I was about 14 at the time.

  • (cs) in reply to diaphanein
    diaphanein:
    snoofle:
    As someone who is just learning Python (as in I just found the man pages and am reading the introduction), it's not always obvious what to look for.

    Of course, if you have half a brain, you can always enter a couple of combinations of: "How do you <x> in <Language>?" into Google...

    import os statinfo = os.stat('somefile.txt') statinfo (33188, 422511L, 769L, 1, 1032, 100, 926L, 1105022698,1105022732, 1105022732) statinfo.st_size 926L

    http://docs.python.org/lib/os-file-dir.html

    Thanks; I had already found it (just for the principle of it) - it took about 2 minutes to check through a couple of Google hits until I found the right one...
  • AZ Wildcat (unregistered) in reply to Russ
    Russ:
    It never ceases to amaze me how many people don't know the constructs that are available to them in the programming language and are too lazy to google what they need.

    The guy was using FORTRAN. This means that Google was probably not invented yet when they first wrote the code. The guy would have to dial into a Wildcat! BBS with his 2400 baud modem to get the answer.

  • (cs) in reply to Olius
    Olius:
    As someone who is just learning Python (as in I just found the man pages and am reading the introduction), it's not always obvious what to look for.

    You could try looking for the tutorials, then work through some examples, then get used to scanning reference pages on python.org then try to convert some of your old code to python for a bit of a laugh then try a few small projects using python instead of bash or C...

    It's a shame that so many people these days confuse "knowing how to find the answer" with "asking google", let alone "asking a BB".

    s/python/perl/g s/python/C/g

    That is the plan - I've only been reading for about an hour!

  • Ben (unregistered) in reply to bstorer

    PipedInputStream and PipedOutputStream may help here. Not used them yet (but am about to in a project coming up). From Java in a Nutshell:

    PipedInputStream

    This class is an InputStream that implements one half of a pipe and is useful for communication between threads.... ... Data read from a PipedInputStream object is recieved from the PipedOutputStream to which it is connected ...

    • ducks, preparing for the inevitable Java guru discourse on why not to use this class ever *
  • DoubleMalt (unregistered) in reply to bstorer

    There is. The concept is called Channels.

    However took me some time to find out, too.

  • anne (unregistered) in reply to Tyler
    Tyler:
    You would not have to guess. You would read "perlfunc", which is the Perl function list, and you would find it under "Functions for filehandles, files, or directories".

    Gee that's hard.

    Amen! or you would look it up in the camel book (yes -- I said the "b" word!)

  • anne (unregistered) in reply to Olius
    Olius:
    s/python/perl/g s/python/C/g

    Your, uh, second substitution there is a no-op. But you knew that. ;)

  • RogerWilco (unregistered) in reply to Unomi
    Unomi:
    Cable:
    Russ:
    It never ceases to amaze me how many people don't know the constructs that are available to them in the programming language and are too lazy to google what they need.

    Edit: fist

    Oh yeah google it, that solves stupidity.

    I think many programs has a 'man page' for this very purpose. If you're stupid enough not to read it, you better don't start scripting without knowing any possibilities left.

    I comes down to know wich path to check first. RTFM, ask a co-worker, read the homepage of the program (maybe updates of the manual), google for specific howto's (and test them first), ask in forums, pray....

    • Unomi -
    The problem I have on Unix/Linux is that you first have to find what command you are looking for. Once you know which man page you need, they areoften quite useful. The same tends to be true for a lot of other libraries too.
  • muttonchop (unregistered) in reply to mkb
    mkb:
    gilleain:
    Ha! I want that on a t-shirt - "If you look at the alternatives, I suck the least!" :)

    This meme has been around a while. A number of years ago I remember a quote from nugget or jwz or some similar programmer/pundit: "X Window is the second worst windowing system but all the others are tied for first."

    Many forms of Government have been tried, and will be tried in this world of sin and woe. No one pretends that democracy is perfect or all-wise. Indeed, it has been said that democracy is the worst form of government except all those other forms that have been tried from time to time.

    -Winston Churchill

  • Therac-25 (unregistered) in reply to bstorer
    Smitty does have one point, though. It is hard to find the -s operator using the man pages, provided all you know is that you want to find the size of a file. But then, how many other programming languages provide such information anywhere in the man files?

    man perlfunc / size <ENTER>

    Oh, there it is.

  • Daniel (unregistered) in reply to riaa
    riaa:
    Which is going to make it easier to read:

    filesize = -s filename filesize = filename.size

    Either one works for me, the variable storing the result is called "filesize" :P

    Ok sure, it works better for interpreting code, but for actually writing the code (which is what this whole WTF and the original post by smitty is about), using -s or some verbose description is just as effective... you still need to search somehow to know what to use. And if you're just going to guess you should be shot on site.

  • (cs) in reply to Steve
    Steve:
    The supercilious superior tone of many of the comments here really bugs me.

    It's not as if we weren't all newbies at one time in our lives. Perhaps some of use learned Perl and C++ at our father's knee but many of use came to these things later along in life.

    As I mentioned before in another comment, sometimes, when you're new to a programming language or even a whole new software environment (such as making the transition from a Windows box to Unix, which is a pretty radical jump), sometimes you don't know how to frame the right question because you don't have all of the vocabulary down.

    ...

    Well said. Few things piss me off more than to be talked down to by some dork with stunted social skills. It's people like them that give our entire industry the bad image of being nerdy, antisocial, loosers who couldn't get laid with $10,000 in a whore house.

    Don't be quick to call someone a moron or feel that you are better than them in anyway because you've spent more time then the other person learning a particular subject. The real moron is the one who can't understand the difference between ignorance and stupidity. I am ignorant about Pearl because I have not studied it, I am not stupid because I can learn it.

    Their ilk is what keeps people from learning more about computers. Most people don't want to be insulted because they don't know how to open up notepad or because they don't know what 'ls' does, so they just don't bother learning.

  • Pádraig Brady (unregistered) in reply to snoofle

    Re fitting python into the unix philosophy have a look at an introductory talk I gave recently to some university students: http://www.pixelbeat.org/talks/linux_and_python/

  • Pádraig Brady (unregistered) in reply to snoofle

    Re fitting python into the unix philosophy, have a look at an introductory talk I gave recently to some university students: http://www.pixelbeat.org/talks/linux_and_python/

  • Andrew (unregistered) in reply to Smitty
    Smitty:
    Oh, I get it, that's what makes perl so 'powerful', it's non-intuitive use of shorthand whenever and wherever possible.

    How would one EVER guess that the supplied code solved that problem. Where would you look to find the '-s' operator (or whatever perl twinks call it.)

    What the hell is wrong with

    $filesize = size_on_disk(filename); or some equally intuitive and easily remembered (or guessed) function name ?

    perl sucks - get over it.

    The coder obviously knew about shell scripting. Otherwise there would not be a shell call with process-pipe operators. The coder clearly never understood anything, but just copied "what works".

    Shell also has the '-s' operator. It is one of the "test" predicates:

    if [ -s $FILE ]; then echo "good file" fi

    When I started my job, they gave many perl scripts (perl4) like this to fix. They had shell calls for everything, even date. Damn was that slow!

  • FridayUK (unregistered) in reply to and i don't even like perl
    Or you could realize that Perl has a number of very serious flaws, chief among them are morons like yourself, Smitty.

    I like Perl and I've been using it for over a decade, but I'm not about to defend '-s' as being 'intuative' in this day and age, I think Smitty's comments were quite accurate and reasonable and indicative of how how most reasonable developers from a wider range of backgrounds would interpret some of Perl's (now arguably anachronistic) behavior.

    I'm surprised at the number of obnoxious comments like your though, I think some people are unable to be objective about it, which is pretty pathetic really (it's just a scripting language, and an increasily creaky one at that). It's not like anyone was insulting Larry's mother (just his baby, boom tsh).

    Perl 5 realative suckyness has increased noticeably in the last few years as comparible languages have improved at a much faster than it has over the last few years (roll on Perl 6...).

    It's still able to hold it's own as a great Unix shell scripting language, that doesn't mean assuming everyone using it comes from the same background and would therefore immediately be familer with it in the same way is a good idea (and that doesn't excuse being a jackass either).

    As it's been brought up:

    Everyone knows PHP has lots of inconisistances when it comes to function naming conventions, that includes it's developers - it's old news (and they've been doing something about it).

    That doesn't excuse them or mean that having quite as many internal functions as it does is something other languages should seek to replicate, but at least it has them - languages like Java and Perl are all the poorer for not having somewhat similar functionally for common operations IMHO.

    When it comes to languages, some people get stuck in ruts endlessly defending the familer I guess (I'm sure there are lots of old of COBOL programmers who feel the same way).

  • Hey Nonny Mouse (unregistered) in reply to bstorer

    Of course you can connect an InputStream to an OutputStream.

    Just do it like this:

    public class IOStream implements Runnable {
      private InputStream in;
      private OutputStream out;
      public IOStream(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
      }
    
      public void run() {
        byte[] buff = new byte[4096];
        int got;
        while ((got = in.read(buff)) > 0)
          out.write(buff, 0, got);
      }
    }
    
    new IOStream(in,out).run();
    
  • (cs)

    About the only thing one can say for the "wc ..." solution is that it actually READS the file, so you know a teensy bit more than what -s tells you. You know the runner has permission to read the file, and you know the file's blocks are readable if you get a non-zero answer.

    Also depending on the end-of-line convention, you'll get a slightly different answer from wc, won't you?

    And does wc count trailing blanks?

    Hmmm....

  • (cs) in reply to RogerWilco
    RogerWilco:
    The problem I have on Unix/Linux is that you first have to find what command you are looking for. Once you know which man page you need, they areoften quite useful. The same tends to be true for a lot of other libraries too.

    That's why there's the over-voweled apropos.

  • (cs) in reply to Ancient_Hacker

    If you use -s, you get the access operators (-r, etc.) for free. A single stat() call fetches that all at once.

  • not surprised (unregistered)

    There is a guy here who I used to respect as a good coder. But he's only known C/C++/Java.

    He suffers from the "C as a first language" syndrome. I've seen some of his Java where he tests boolean vaiables as if has_lock == true then

    He tried to learn some Perl to better understand how I build prototypes. Most of his code consisted of multiple calls such as system( ... ); system( ... ); system( ... ); without any variables in Perl at all.

    Just last month he decided to change one of my demo cgi scripts. Changed it to use a system call to sed exactly in the same way as in the article.

  • lurkee-lurk (unregistered) in reply to Nah
    Nah:
    Axit:
    jtwine:
    >That is the beauty of C++ - you get C's stuff with it. :)
    And by far it's greatest weakness.

    The RWTF is not knowing the difference between "it's" and "its".

    It's called the possessive case. Back to middle school for the Gramma Police.

  • non believer (unregistered)

    If this code change reduced anything by 75 minutes per run then the rest of the application must be a horrible mess.

    As someone above estimated: half a million file sizes on every run !

  • (cs)

    Giving sysadmins and other shell-monkeys access to perl or other scripting language can produce some code that looks awful, runs slow, and is fragile as hell. However, it's almost always prettier, faster, and less fragile then what they were using before.

    So while a good-natured laugh at their attempts is fine, I refuse to ridicule someone that engaged a tool outside of their domain to improve their productivity for not taking the time to master a language or best practices. In this case we're talking about chemistry grad students, not programmers. It's likely programming is just a necessary evil of their research, and as soon as possible they will hoist it on to their own grad students.

    Now when someones been using perl for 4 hours a day for years and still produces stuff like this, it's time to take them behind the shed and tie them to a library of Perl books.Even if programming isn't their passion it's enough of their job that they are robbing themselves by not becoming competent with it.

  • PseudoNoise (unregistered) in reply to lurkee-lurk
    lurkee-lurk:
    Nah:
    Axit:
    jtwine:
    >That is the beauty of C++ - you get C's stuff with it. :)
    And by far it's greatest weakness.

    The RWTF is not knowing the difference between "it's" and "its".

    It's called the possessive case. Back to middle school for the Gramma Police.

    Possessive pronouns never use an apostrophe: its, hers, his, ours, theirs, ones.

    It's (i.e., "it is") not rocket science.

  • Daniel (unregistered) in reply to Ancient_Hacker
    Ancient_Hacker:
    About the only thing one can say for the "wc ..." solution is that it actually READS the file

    $10 says using -r is a hell of a lot faster than making a call to wc and checking the return value.

  • Luca Masters (unregistered) in reply to lurkee-lurk
    lurkee-lurk:
    It's called the possessive case. Back to middle school for the Gramma Police.
    Indeed. Hi's teachers would be very disappointed.

    (Oh, snap! ;-)

  • B (unregistered) in reply to Marcin
    Marcin:
    Hold on...does PERL not have an easy way to destructure the output of commands into variables? (I mean to parse it very simply into a bunch of variables, then select the contents of the required variables)

    Well, you certainly can do:

    @q = split (/\s+/, uptime);

    and get the individual fields into the array q (ie, $q[0] will have the current time etc.). You can split at any regex, not just \s (sequence of whitespace).

  • ysth (unregistered)

    Doing a universal replacement with the -s variant could break things, since the special "whatever was last stat'd" filehandle "_" will give different results.

  • diaphanein (unregistered) in reply to FridayUK
    FridayUK:
    Or you could realize that Perl has a number of very serious flaws, chief among them are morons like yourself, Smitty.

    I like Perl and I've been using it for over a decade, but I'm not about to defend '-s' as being 'intuative' in this day and age, I think Smitty's comments were quite accurate and reasonable and indicative of how how most reasonable developers from a wider range of backgrounds would interpret some of Perl's (now arguably anachronistic) behavior.

    I'm surprised at the number of obnoxious comments like your though, I think some people are unable to be objective about it, which is pretty pathetic really (it's just a scripting language, and an increasily creaky one at that). It's not like anyone was insulting Larry's mother (just his baby, boom tsh).

    Perl 5 realative suckyness has increased noticeably in the last few years as comparible languages have improved at a much faster than it has over the last few years (roll on Perl 6...).

    It's still able to hold it's own as a great Unix shell scripting language, that doesn't mean assuming everyone using it comes from the same background and would therefore immediately be familer with it in the same way is a good idea (and that doesn't excuse being a jackass either).

    As it's been brought up:

    Everyone knows PHP has lots of inconisistances when it comes to function naming conventions, that includes it's developers - it's old news (and they've been doing something about it).

    That doesn't excuse them or mean that having quite as many internal functions as it does is something other languages should seek to replicate, but at least it has them - languages like Java and Perl are all the poorer for not having somewhat similar functionally for common operations IMHO.

    When it comes to languages, some people get stuck in ruts endlessly defending the familer I guess (I'm sure there are lots of old of COBOL programmers who feel the same way).

    Truthfully, my biggest complaint against perl is the shear volume of operators. From what I understand, Perl 6 isn't going to fix this...its going to make it worse. A figure I've heard quoted is around 200 new operators. While yes, I can read perl, it takes me 5-10 times longer to read and comprehend a perl script than a comparable c++ program even. Having to discern between hundreds of operators that behave differently in different contexts requires a lot more concentration

    The preference given to operators over libraries makes navigating perl a nightmare for an outsider. As a maintainer I'd rather see:

    a = list(...) a = [b + 1 for b in a]

    or:

    int a[] = {...} const int a_size = sizeof(a) / sizeof(*a); for (int i = 0; i < a_size; ++i) a[i] += 1;

    than:

    $a ^+= 1;

    Another problem with so many terse, similar operators is debugging.

    Example:

    $a = 1; $b = 2; $c = $a // $b;

    Now, I when I write this, I know I mean to default $c to $b if $a is undefined. But, when I come back 6 months from now, I might question myself: did I intend to default, or divide? The only way I can clarify this is via comments, which means I've now lost the benefit of a terse language.

    Personally, I would rather my code be human readable.

  • dnm (unregistered) in reply to ssprencel
    ssprencel:
    Steve:
    The supercilious superior tone of many of the comments here really bugs me.

    It's not as if we weren't all newbies at one time in our lives. Perhaps some of use learned Perl and C++ at our father's knee but many of use came to these things later along in life.

    As I mentioned before in another comment, sometimes, when you're new to a programming language or even a whole new software environment (such as making the transition from a Windows box to Unix, which is a pretty radical jump), sometimes you don't know how to frame the right question because you don't have all of the vocabulary down.

    ...

    Well said. Few things piss me off more than to be talked down to by some dork with stunted social skills. It's people like them that give our entire industry the bad image of being nerdy, antisocial, loosers who couldn't get laid with $10,000 in a whore house.

    Don't be quick to call someone a moron or feel that you are better than them in anyway because you've spent more time then the other person learning a particular subject. The real moron is the one who can't understand the difference between ignorance and stupidity. I am ignorant about Pearl because I have not studied it, I am not stupid because I can learn it.

    Their ilk is what keeps people from learning more about computers. Most people don't want to be insulted because they don't know how to open up notepad or because they don't know what 'ls' does, so they just don't bother learning.

    The issue that comes into play here is twofold, however.

    #1: In today's day and age, when you're doing something that stupid, if you're worth your salt, you'll stop, and think, "there must be a smarter way to do this", and ask google.

    The first result in google is the correct one.

    #2: This damned industry is filled with weenies who can't write good code to save their lives, but think that this industry is 'easy money' so they're here, filling our world with crappy unmaintainable code.

    What's most unsettling about these types, is you can try and help and correct them, as I often have, only to be met with resistance as if you've challenged their manhood or something.

    When I work with people smarter than me, I leech every last drop of knowledge I can from them, because it's where I've learned the most.

  • diaphanein (unregistered) in reply to dnm
    dnm:
    ssprencel:
    Steve:
    The supercilious superior tone of many of the comments here really bugs me.

    It's not as if we weren't all newbies at one time in our lives. Perhaps some of use learned Perl and C++ at our father's knee but many of use came to these things later along in life.

    As I mentioned before in another comment, sometimes, when you're new to a programming language or even a whole new software environment (such as making the transition from a Windows box to Unix, which is a pretty radical jump), sometimes you don't know how to frame the right question because you don't have all of the vocabulary down.

    ...

    Well said. Few things piss me off more than to be talked down to by some dork with stunted social skills. It's people like them that give our entire industry the bad image of being nerdy, antisocial, loosers who couldn't get laid with $10,000 in a whore house.

    Don't be quick to call someone a moron or feel that you are better than them in anyway because you've spent more time then the other person learning a particular subject. The real moron is the one who can't understand the difference between ignorance and stupidity. I am ignorant about Pearl because I have not studied it, I am not stupid because I can learn it.

    Their ilk is what keeps people from learning more about computers. Most people don't want to be insulted because they don't know how to open up notepad or because they don't know what 'ls' does, so they just don't bother learning.

    The issue that comes into play here is twofold, however.

    #1: In today's day and age, when you're doing something that stupid, if you're worth your salt, you'll stop, and think, "there must be a smarter way to do this", and ask google.

    The first result in google is the correct one.

    #2: This damned industry is filled with weenies who can't write good code to save their lives, but think that this industry is 'easy money' so they're here, filling our world with crappy unmaintainable code.

    What's most unsettling about these types, is you can try and help and correct them, as I often have, only to be met with resistance as if you've challenged their manhood or something.

    When I work with people smarter than me, I leech every last drop of knowledge I can from them, because it's where I've learned the most.

    And besides, I got laid at the whorehouse, and it only cost me $5. Granted, she only had 1 tooth left...

  • TheRealBill (unregistered) in reply to bstorer
    bstorer:
    Unomi:
    I think the Perl philosophy 'TIMTODI' can leave some bad examples too.....
    • Unomi -
    I think you mean "TIMTOWTDI", though I've also seen it as "TIMTOWDI". Perhaps we should just refer to it as /TIMTOWT?DI/ ...

    I prefer: TATDMWTDI There Are Too Damned Many Ways To Do It

  • (cs) in reply to Unomi
    Unomi:
    I think the Perl philosophy 'TIMTODI' can leave some bad examples too.....
    • Unomi -

    It absolutely can, and it is one of the many things that makes Perl a curse word in the minds of some folks.

    ...of course, such thinking fails to address the simple matter that you can write bad code in any language, and thus, TDWTF was born.

  • TheRealBill (unregistered) in reply to Tyler
    Tyler:

    You would not have to guess. You would read "perlfunc", which is the Perl function list, and you would find it under "Functions for filehandles, files, or directories".

    Gee that's hard.

    Yup cuz we all know that beginners intuitively know to take the name of the programming language, tack on "func" and answer their questions. Heck, it's something that come sin real handy when doing anything else.

    Wait you mean that there is no "cfunc", "pythonfunc", "bashfunc", "lispfunc", etc? Oh, well then maybe it is something only an experienced or trained perler would reactively know. (That or someone who spent time googling and searching so they could post it and appear to be knowledgeable.)

    This problem isn't specific to Perl or any language, it's a hindsight or familiarity problem. But seriously I've not yet met anyone who not having used it a lot needed a Perl (Python, PHP, bash, ksh, scheme, lisp...) question related to functions and thought "I know, I'll try to combine the name of the language with the first 4 letters of the word function and look there!"

Leave a comment on “The UNIX Philosophy”

Log In or post as a guest

Replying to comment #:

« Return to Article