http://qs1969.pair.com?node_id=551754

system "vent";
I'm obviously new to perl. I feel a bit like cackling right now because I was driving myself mad trying to do a simple file copy. After many hand to head movements, I realized that there was a newline returned from date (timestamp) that was screwing up the copy. Ouch. The perl gods are laughing and pointing at me, but still I walk on.
system "unvent";

Replies are listed 'Best First'.
Re: elated frustration
by McDarren (Abbot) on May 26, 2006 at 04:49 UTC
    heh.... if you are new to Perl, then you obviously already have or will soon be obtaining your very own copy of The Camel :D

    Assuming you get the 3rd Edition (recommended), have a flick through the start of Chapter 24. You'll find sections entitled "Common Goofs for Novices" and "Universal Blunders", etc.

    Might save you a few similar head-banging episodes in the future :)

    Cheers,
    Darren :)

    PS: Most of the Camel is also available in the online doco, but I prefer (and recommend) having a copy of the book

Re: elated frustration
by zentara (Archbishop) on May 26, 2006 at 10:47 UTC
    The one good thing about "learning the hard way" is that you remember it longer. :-)

    I'm not really a human, but I play one on earth. flash japh
Re: elated frustration
by derby (Abbot) on May 26, 2006 at 12:49 UTC

    Congrats ... but now do

    system "bang head";
    File::Copy
    system "stop that hurts";

    -derby
Re: elated frustration
by ForgotPasswordAgain (Priest) on May 26, 2006 at 16:03 UTC
    I'll ++ you just for the phrases "elated frustration" and "hand to head movements".
Re: elated frustration
by Jenda (Abbot) on May 28, 2006 at 21:01 UTC

    You mean from something like: my $date = `date`;? Have a look at

    perldoc -f localtime
    perldoc -f gmtime
    perldoc POSIX
      and look for "strftime"
    
    One handy trick to remember is to always put some delimiters around a variable in a test print:
    print "\$var: >$var<\n";
    They would make the newline at the end apparent. What delimiters to use depends on the expected value of course.

Re: elated frustration
by BerntB (Deacon) on May 27, 2006 at 01:41 UTC
    The perl gods are laughing and pointing at me
    No, they aren't. AFAIK, they seem very nice.

    (-: And they will probably remain nice, since it is sadly unlikely that I get so good that I am declared to reach apotheosis and joins them! :-)

Re: elated frustration
by johndageek (Hermit) on Jun 22, 2006 at 02:15 UTC
    Anyone pointing and laughing, obviously is not a god, and just as obvioulsy has no experience in the feild.

    e.g. Parenting.

    In store new parent is pushing a cart while chld crawls along on the floor, barking at various shoppers.

    The ones sniggering and pointing while saying things like "MY child will never do that!", are non-parents (the unexperienced)

    The ones smiling in sympathy, are the parents who have had children, and know the new parent may be embarassed, but has no need to be. Many of these parents have had kids do many creative things that cause parental hand to head movements, as well as head to wall movements.

    Walk on in pride, knowing you will one day easily lend a hand to one who has less experience than yourself, who you will understand better than they will know at the time.

    Enjoy the journey, because at the end you will see, the journey is all there was.

    Enjoy!
    Dageek