Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RE: it is amazing sometimes how little you know...

by barndoor (Pilgrim)
on Jul 05, 2000 at 20:34 UTC ( #21158=note: print w/replies, xml ) Need Help??


in reply to it is amazing sometimes how little you know...

I've only been using perl for a few months and am still in the 'refer to O'Reilly every 1/2 hour' phase. Already when I look at my early scripts, I can see how much I've learn't in that time. Even so, every day I learn another 20 things that make me go Wow! Like yourself I usually come across these snippets of wisdom by accident when looking for something else or trying to solve an unrelated problem. However, each day my scripts get cleaner, neater and a little closer to what can be regarded virtuous perl.
  • Comment on RE: it is amazing sometimes how little you know...

Replies are listed 'Best First'.
RE: RE: it is amazing sometimes how little you know...
by BBQ (Deacon) on Jul 06, 2000 at 02:53 UTC
    I know that feeling. And beleive me it gets worse as you grow older in/with perl. The other day I caught myself blushing while reading my own code! I had to alter stuff that I had done a couple of years ago, and downloaded a script that had been working for that period of time.

    This particular system was using flatfiles to generate a product list, and keep track of orders posted via web. Something in the lines of a pre-historic shopping cart, if you will. Well, to get the bottom of it, I found things in the script like: (please note the lack of my and local usage)
    @tmp = <FILE>; foreach $line (@tmp) { chop $line; ($foo,$bar) = split(/\t/,$line); $HASH{$foo} = $bar; } foreach $key (keys %HASH) { print "<some html>$key - $HASH{$key}</some html>\n"; }
    ... and other pearls of the sort! (pun intended) I'm sure at the time I thought I had a good reason to hash and then loop the hash, but now, looking at the file, I fail to find it. If I had to re-write the entire script nowadays, I'd do it in a very different fashion. Maybe something in the lines of:
    while (<FILE>) { m/(^.*)\t(.*$)/; print "<some html>$1 - $2</some html>\n"; }
    Come to think of it, even the HTML is so bad that I would do it a different way! I dunno, at this point I'm just rambling. I don't think that this feeling is ever going to get any better. Maybe in two years I'll look back at the stuff I'm doing today and go EEEEK! And maybe four years from now I'll look back on the stuff that I'll do in two years and go EEEEK! as well? Who knows...

    #!/home/bbq/bin/perl
    # Trust no1!
RE: RE: it is amazing sometimes how little you know...
by davorg (Chancellor) on Jul 06, 2000 at 11:53 UTC

    Does anyone ever get past the "refer to O'Reilly every 1/2 hour" stage? Of course, as you progress it will be _different_ O'Reilly books that you'll be refering to.

    --
    <http://www.dave.org.uk>

    European Perl Conference - Sept 22/24 2000, ICA, London
    <http://www.yapc.org/Europe/>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://21158]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2020-04-01 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (18 votes). Check out past polls.

    Notices?