Provided by: manpages-zh_1.5.2-1_all bug

NAME

       perlfaq - Perl  (2003/01/31 17:37:17)

DESCRIPTION

       perlfaq

       Where to get the perlfaq

        comp.lang.perl.misc http://www.perldoc.com/  http://faq.perl.org/
       http://2Ti.com/cgi-bin/2T/perl/
       ftp://www.math.ncu.edu.tw/pub/staff/chenym/FAQ/Perl/  <pailing@2Ti.com>

       How to contribute to the perlfaq   perlfaq

        perlfaq-workers@perl.org .   FAQ comp.lang.perl.misc
       http://cvs.perl.org/cvsweb/perlfaq/  ()CVS  FAQ

       What will happen if you mail your Perl programming problems to the
       authors

        FAQ perlfaq-workers@perl.com

        FAQ  comp.lang.perl.misc

Credits

        perlfaq  Tom Christiansen  Tom  Nathan Torkington  perlfaq-workers
       (perlfaq-workers@perl.org)

Author and Copyright Information

       Copyright (c) 1997-2003 Tom Christiansen, Nathan Torkington, and other
       contributors noted in the answers.

       All rights reserved.

       Bundled Distributions

       This documentation is free; you can redistribute it and/or modify it
       under the same terms as Perl itself.

       Irrespective of its distribution, all code examples in these files are
       hereby placed into the public domain.  You are permitted and encouraged
       to use this code in your own programs for fun or for profit as you see
       fit.  A simple comment in the code giving credit would be courteous but
       is not required.

       Disclaimer

       This information is offered in good faith and in the hope that it may
       be of use, but is not guaranteed to be correct, up to date, or suitable
       for any particular purpose whatsoever.  The authors accept no liability
       in respect of this information or its use.

Table of Contents

       perlfaq  -
       perlfaq1 -  Perl
       perlfaq2 -  Perl
       perlfaq3 -
       perlfaq4 -
       perlfaq5 -
       perlfaq6 -
       perlfaq7 -
       perlfaq8 -
       perlfaq9 -

The Questions

       perlfaq1:  Perl

        Perl

       o    Perl?

       o    Perl

       o    Perl

       o   perl4  perl5

       o   perl6 ?

       o   Perl

       o   Perl

       o   Perl Java, Python, REXX, Scheme, Tcl

       o    Perl

       o    Perl

       o   perlPerl

       o   Perl program script

       o   JAPH

       o    Larry Wall  (witticisms)

       o    5/5.8.3  Perl

       perlfaq2:  Perl

        Perl

       o    Perl

       o    Perl

       o    C perl

       o    Perl

       o    perl gdbm/dynamic loading/malloc/linking/...

       o   Perl CPAN CPAN/src/...

       o    ISO ANSI Perl

       o   Perl

       o   USENET Perl

       o

       o   Perl

       o    Perl

       o    Perl FTP  WWW

       o    Perl

       o   comp.lang.perl.misc

       o    Perl

       o    bugs

       o    perl.com? Perl Mongers? pm.org? perl.org? cpan.org?

       perlfaq3:

       o    ()?

       o    Perl?

       o    Perl shell?

       o

       o    Perl ?

       o    (profile)  perl ?

       o    Perl (cross-reference)?

       o    Perl (pretty-printer)?

       o    Perl ctags ?

       o    IDE  Perl

       o    vi  Perl

       o    emacs perl?

       o    Perl curses?

       o   X Tk Perl?

       o    CGI Tk ?

       o    Perl?

       o    Perl

       o   ?

       o   ?

       o    CGI (script)?

       o    Perl?

       o    Perl byte code C?

       o    Perl  Java?

       o    "#!perl"  [MS-DOS,NT,...] ?

       o   ?

       o    perl  DOS/Mac/VMS?

       o    Perl CGI Web?

       o    Perl

       o    Perl  C [h2xs, xsubpp]

       o    perlembed,perlguts  C  perl

       o

       o    MakeMaker?

       perlfaq4:

       o   Why am I getting long decimals (eg, 19.9499999999999) instead of
           the numbers I should be getting (eg, 19.95)?

       o   Why isn't my octal data interpreted correctly?

       o   Does Perl have a round() function?  What about ceil() and floor()?
           Trig functions?

       o   How do I convert between numeric representations?

       o   Why doesn't & work the way I want it to?

       o   How do I multiply matrices?

       o   How do I perform an operation on a series of integers?

       o   How can I output Roman numerals?

       o   Why aren't my random numbers random?

       o   How do I get a random number between X and Y?

       o   How do I find the day or week of the year?

       o   How do I find the current century or millennium?

       o   How can I compare two dates and find the difference?

       o   How can I take a string and turn it into epoch seconds?

       o   How can I find the Julian Day?

       o   How do I find yesterday's date?

       o   Does Perl have a Year 2000 problem?  Is Perl Y2K compliant?

       o   How do I validate input?

       o   How do I unescape a string?

       o   How do I remove consecutive pairs of characters?

       o   How do I expand function calls in a string?

       o   How do I find matching/nesting anything?

       o   How do I reverse a string?

       o   How do I expand tabs in a string?

       o   How do I reformat a paragraph?

       o   How can I access or change N characters of a string?

       o   How do I change the Nth occurrence of something?

       o   How can I count the number of occurrences of a substring within a
           string?

       o   How do I capitalize all the words on one line?

       o   How can I split a [character] delimited string except when inside
           [character]?

       o   How do I strip blank space from the beginning/end of a string?

       o   How do I pad a string with blanks or pad a number with zeroes?

       o   How do I extract selected columns from a string?

       o   How do I find the soundex value of a string?

       o   How can I expand variables in text strings?

       o   What's wrong with always quoting "$vars"?

       o   Why don't my <<HERE documents work?

       o   What is the difference between a list and an array?

       o   What is the difference between $array[1] and @array[1]?

       o   How can I remove duplicate elements from a list or array?

       o   How can I tell whether a certain element is contained in a list or
           array?

       o   How do I compute the difference of two arrays?  How do I compute
           the intersection of two arrays?

       o   How do I test whether two arrays or hashes are equal?

       o   How do I find the first array element for which a condition is
           true?

       o   How do I handle linked lists?

       o   How do I handle circular lists?

       o   How do I shuffle an array randomly?

       o   How do I process/modify each element of an array?

       o   How do I select a random element from an array?

       o   How do I permute N elements of a list?

       o   How do I sort an array by (anything)?

       o   How do I manipulate arrays of bits?

       o   Why does defined() return true on empty arrays and hashes?

       o   How do I process an entire hash?

       o   What happens if I add or remove keys from a hash while iterating
           over it?

       o   How do I look up a hash element by value?

       o   How can I know how many entries are in a hash?

       o   How do I sort a hash (optionally by value instead of key)?

       o   How can I always keep my hash sorted?

       o   What's the difference between "delete" and "undef" with hashes?

       o   Why don't my tied hashes make the defined/exists distinction?

       o   How do I reset an each() operation part-way through?

       o   How can I get the unique keys from two hashes?

       o   How can I store a multidimensional array in a DBM file?

       o   How can I make my hash remember the order I put elements into it?

       o   Why does passing a subroutine an undefined element in a hash create
           it?

       o   How can I make the Perl equivalent of a C structure/C++ class/hash
           or array of hashes or arrays?

       o   How can I use a reference as a hash key?

       o   How do I handle binary data correctly?

       o   How do I determine whether a scalar is a
           number/whole/integer/float?

       o   How do I keep persistent data across program calls?

       o   How do I print out or copy a recursive data structure?

       o   How do I define methods for every class/object?

       o   How do I verify a credit card checksum?

       o   How do I pack arrays of doubles or floats for XS code?

       perlfaq5:

       I/O and the "f" issues: filehandles, flushing, formats, and footers.

       o   How do I flush/unbuffer an output filehandle?  Why must I do this?

       o   How do I change one line in a file/delete a line in a file/insert a
           line in the middle of a file/append to the beginning of a file?

       o   How do I count the number of lines in a file?

       o   How can I use Perl's "-i" option from within a program?

       o   How do I make a temporary file name?

       o   How can I manipulate fixed-record-length files?

       o   How can I make a filehandle local to a subroutine?  How do I pass
           filehandles between subroutines?  How do I make an array of
           filehandles?

       o   How can I use a filehandle indirectly?

       o   How can I set up a footer format to be used with write()?

       o   How can I write() into a string?

       o   How can I output my numbers with commas added?

       o   How can I translate tildes (~) in a filename?

       o   How come when I open a file read-write it wipes it out?

       o   Why do I sometimes get an "Argument list too long" when I use <*>?

       o   Is there a leak/bug in glob()?

       o   How can I open a file with a leading ">" or trailing blanks?

       o   How can I reliably rename a file?

       o   How can I lock a file?

       o   Why can't I just open(FH, ">file.lock")?

       o   I still don't get locking.  I just want to increment the number in
           the file.  How can I do this?

       o   All I want to do is append a small amount of text to the end of a
           file.  Do I still have to use locking?

       o   How do I randomly update a binary file?

       o   How do I get a file's timestamp in perl?

       o   How do I set a file's timestamp in perl?

       o   How do I print to more than one file at once?

       o   How can I read in an entire file all at once?

       o   How can I read in a file by paragraphs?

       o   How can I read a single character from a file?  From the keyboard?

       o   How can I tell whether there's a character waiting on a filehandle?

       o   How do I do a "tail -f" in perl?

       o   How do I dup() a filehandle in Perl?

       o   How do I close a file descriptor by number?

       o   Why can't I use "C:\temp\foo" in DOS paths?  What doesn't
           `C:\temp\foo.exe` work?

       o   Why doesn't glob("*.*") get all the files?

       o   Why does Perl let me delete read-only files?  Why does "-i" clobber
           protected files?  Isn't this a bug in Perl?

       o   How do I select a random line from a file?

       o   Why do I get weird spaces when I print an array of lines?

       perlfaq6:

       o   ?

       o   ?

       o   ?

       o    $/?

       o    LHS RHS?

       o    "\w"  (accented)?

       o    locale "/[a-zA-Z]/" ?

       o    (quote) ?

       o   "/o" ?

       o    C?

       o    Perl?

       o   ??

       o   ?

       o   ?

       o   ?

       o   ?

       o    "\b" ?

       o    $&, $`, $'?

       o    "\G" ?

       o   Perl DFA  NFA? POSIX ?

       o    grep map?

       o   ?

       o

       perlfaq7:

        Perl

       o    Perl BNF/yacc/RE

       o   $@%*

       o   /

       o

       o

       o    (extension)

       o    Perl C

       o   /

       o

       o

       o

       o

       o

       o   /{ Function,  FileHandle,  Array,  Hash,  Method,  Regex}?

       o

       o   local()  my() ?

       o

       o

       o    "my($foo) = <FILE>;"

       o

       o    &foo  foo() ?

       o

       o

       o

       o

       o    perl

       o

       o

       o   "bad interpreter" ?

       perlfaq8:

        (IPC),  ()

       o

       o    exec() ?

       o

       o

       o

       o

       o

       o

       o

       o

       o

       o

       o   /

       o    Unix  shadow

       o

       o    sleep()  alarm() ?

       o

       o    atexit() setjmp()/longjmp()

       o    sockets System V (Solaris)

       o    Perl C

       o    ioctl() syscall()

       o    setuid perl

       o    (pipe)

       o    system()

       o    STDERR

       o    open()

       o

       o    shell

       o    EOFUnix ^DMS-DOS ^Z STDIN

       o    shell perl

       o   perl telnet ftp

       o    Perl Expect

       o    perl "ps"

       o    perl script {}

       o

       o    fork

       o

       o

       o    CPU ?

       o    Unix

       o    SQL ?

       o    system()  control-C ?

       o

       o    CPAN ?

       o   require  use

       o   /

       o   /

       o    include

       o    socket.ph

       perlfaq9:

        web

       o    CGI

       o    CGI  (500 Server Error)

       o    CGI

       o    HTML

       o    URL?

       o

       o    HTML ?

       o    HTML ?

       o    HTML ?

       o    web  %-encoding?

       o

       o

       o    Perl  .htpasswd  .htgroup ?

       o    CGI

       o

       o    CGI

       o

       o    MIME/BASE64 ?

       o

       o

       o    MIME

       o

       o   //IP

       o

       o   / FTP ?

       o    RPC ?

       bbbush