Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Never

by broquaint (Abbot)
on May 12, 2003 at 23:51 UTC ( #257603=note: print w/replies, xml ) Need Help??


in reply to Never-to-use Perl features?

  • getc - doesn't do what one would expect
  • inline globs - is prone to mixing up filehandle reads
  • first arg of open - isn't intuitive
  • nested subroutines - broken to a degree

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Never: open()
by bart (Canon) on May 13, 2003 at 17:59 UTC
    The first argument of open()? I have some other problems with it:
    • Single argument open — silliness beyond belief
    • Combined argument for open mode and filepath (the 3-argument open() remedies that)
    Anyway, I feel it would make more sense that open() would return a filehandle instead of modifying one of its arguments and return a flag. But then, Perl didn't work like that in the old days.
Re: Re: Never
by enoch (Chaplain) on May 13, 2003 at 15:57 UTC

    What's wrong with getc?

    From perldoc:

    getc FILEHANDLE
    getc

    Returns the next character from the input file attached to FILEHANDLE, or the undefined value at end of file, or if there was an error. If FILEHANDLE is omitted, reads from STDIN. This is not particularly efficient. However, it cannot be used by itself to fetch single characters without waiting for the user to hit enter. For that, try something more like:

    That sounds like how I expect getc to work. Or, am I missing something?

    enoch
      That sounds like how I expect getc to work. Or, am I missing something?
      It does indeed work as the docs say (much like all of Perl's other foibles listed in this thread) but when processing STDIN it doesn't work as one might initially expect (grab a char, return it). This is not so much a fault on Perl's behalf but that of the C implmentation of getc.
      HTH

      _________
      broquaint

        I guess it works as I expected it to, because it works like C and Unix have worked for centuries. Okay, well, when was the epoch again?

        Perl is a study in the "History of Unix." If you're not up on the history of Unix, you're going to be shocked by Perl. A lot. Often. Harshly.

        --
        [ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2023-12-03 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (20 votes). Check out past polls.

    Notices?