Perl-Users-Request@virginia.edu (Digestifier) (11/12/90)
Perl-Users Digest #470, Volume #1 Sun, 11 Nov 90 03:13:58 EST Contents: Re: PERL compiler ?!? (Randal Schwartz) errata patch for Texinfo version of perl manual (0.3b -> 0.3c) (Jeff Kellem) Re: Need help with (\d+) problem (s/...(\d+)/$1/ not working?) (Gordon C. Galligher) Re: Perl-Users Digest #468 (Dov Peter Grobgeld) ---------------------------------------------------------------------------- From: merlyn@iwarp.intel.com (Randal Schwartz) Subject: Re: PERL compiler ?!? Date: 11 Nov 90 00:42:21 GMT Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) In article <MITCH.90Nov9124943@hq.af.mil>, mitch@hq (Mitch Wright) writes: | Even if this message gets alot of BOOs, I still think it would be a nifty | project -- maybe for a compiler class. We went through this about six months ago. If you have power of "eval", you have to have an interpreter in the run-time package. And since Larry goes to great pains to compile the code to an efficient pile-o'-bits before running it, you probably wouldn't gain much by turning that data structure inside-out into a bunch of procedure calls. But, hey, if you've got student labor, go for it. :-) | ``A system without PERL is like a hockey game without a fight.'' | -- Mitch Wright Can we put that in The Book? That's a good one! print "Just another Perl [book] hacker," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel put the 'backward' in 'backward compatible'..."=========/ ------------------------------ From: composer@chem.bu.edu (Jeff Kellem) Subject: errata patch for Texinfo version of perl manual (0.3b -> 0.3c) Date: 11 Nov 90 03:29:51 GMT Reply-To: composer@chem.bu.edu The following patch brings the Texinfo version of the perl manual to edition 0.3c which matches perl version 3.0 patchlevel 40. Of course, newly pre-formatted Info files are available in the chem.bu.edu:~ftp/pub/perl-manual directory. Enjoy! -jeff Jeff Kellem Internet: composer@chem.bu.edu Errata for release 0.3b of Texinfo version of perl manual ========================================================= This patch is only needed if you obtained the Texinfo version of the perl manual, 0.3b, before 10 November 1990 10:00pm EST. If you just grabbed this file along with the texinfo/info files, there is no need to apply this patch. This patch mainly includes some small typo fixes and updates the manual to include info on perl 3.0 patchlevel 40. This patch changes the edition number from 0.3b to 0.3c. Cheers... -jeff Jeff Kellem Internet: composer@chem.bu.edu ===CUT HERE===diff -c perl.texinfo{-3b-release,}=== *** perl.texinfo-3b-release Sat Nov 10 21:52:35 1990 --- perl.texinfo Sat Nov 10 21:55:20 1990 *************** *** 40,47 **** @titlepage @title Perl Manual (Texinfo version) ! @subtitle for perl version 3.0 patchlevel 37 ! @subtitle Edition 0.3b, dated 29 October 1990, printed on @today{} @sp 2 @center This is a @strong{DRAFT} copy of the Texinfo version of the perl manual! --- 40,47 ---- @titlepage @title Perl Manual (Texinfo version) ! @subtitle for perl version 3.0 patchlevel 40 ! @subtitle Edition 0.3c, dated 10 November 1990, printed on @today{} @sp 2 @center This is a @strong{DRAFT} copy of the Texinfo version of the perl manual! *************** *** 77,84 **** @comment node-name, next, previous, up @ifinfo ! This Info file contains edition 0.3b, dated 29 October 1990, "printed" on ! @today{} of the Perl Manual for Perl version 3.0 patchlevel 37. This is a @strong{DRAFT} copy of the Texinfo version of the perl manual! @end ifinfo --- 77,84 ---- @comment node-name, next, previous, up @ifinfo ! This Info file contains edition 0.3c, dated 10 November 1990, "printed" on ! @today{} of the Perl Manual for Perl version 3.0 patchlevel 40. This is a @strong{DRAFT} copy of the Texinfo version of the perl manual! @end ifinfo *************** *** 2145,2154 **** point arithmetic (as the endian-ness of the memory representation is not part of the IEEE spec). Note that perl uses doubles internally for all numeric calculation, and converting from double to float back to double ! will loose precision (i.e. @samp{unpack("f", pack("f", $foo))}) will not in general equal @samp{$foo}).@refill - @c @@@@ nnativeative should be native @@@@ orig man page problem pl27 - @c @@@@ (i.e. ... needed extra closing paren @@@@ orig man page pl27 Examples:@refill --- 2145,2152 ---- point arithmetic (as the endian-ness of the memory representation is not part of the IEEE spec). Note that perl uses doubles internally for all numeric calculation, and converting from double to float back to double ! will lose precision (i.e. @samp{unpack("f", pack("f", $foo))} will not in general equal @samp{$foo}).@refill Examples:@refill *************** *** 2839,2845 **** @c @@@@ orig problem in perl man pg pl27 -- chg makelib to h2ph @@@@ @c @@@@ fcntl.h --> fcntl.ph -- ditto @@@@ ! first to get the correct function definitions. If @samp{fcntl.ph} doesn't exist or doesn't have the correct definitions you'll have to roll your own, based on your C header files such as @file{<sys/fcntl.h>}. (There is a perl script called @samp{h2ph} that --- 2837,2843 ---- @c @@@@ orig problem in perl man pg pl27 -- chg makelib to h2ph @@@@ @c @@@@ fcntl.h --> fcntl.ph -- ditto @@@@ ! first to get the correct function definitions. If @file{fcntl.ph} doesn't exist or doesn't have the correct definitions you'll have to roll your own, based on your C header files such as @file{<sys/fcntl.h>}. (There is a perl script called @samp{h2ph} that *************** *** 3144,3150 **** @findex seekdir Sets the current position for the @code{readdir()} routine on @var{DIRHANDLE}. @var{POS} must be a value returned by ! @code{seekdir()}. Has the same caveats about possible directory compaction as the corresponding system library routine.@refill @item telldir(@var{DIRHANDLE}) --- 3142,3148 ---- @findex seekdir Sets the current position for the @code{readdir()} routine on @var{DIRHANDLE}. @var{POS} must be a value returned by ! @code{telldir()}. Has the same caveats about possible directory compaction as the corresponding system library routine.@refill @item telldir(@var{DIRHANDLE}) *************** *** 3841,3848 **** @} @end example ! @item tr/@var{SEARCHLIST}/@var{REPLACEMENTLIST}/ ! @itemx y/@var{SEARCHLIST}/@var{REPLACEMENTLIST}/ @cindex translate function @findex translate function @cindex @code{tr/SEARCHLIST/REPLACEMENTLIST/} --- 3839,3846 ---- @} @end example ! @item tr/@var{SEARCHLIST}/@var{REPLACEMENTLIST}/cds ! @itemx y/@var{SEARCHLIST}/@var{REPLACEMENTLIST}/cds @cindex translate function @findex translate function @cindex @code{tr/SEARCHLIST/REPLACEMENTLIST/} *************** *** 3851,3861 **** @findex y/SEARCHLIST/REPLACEMENTLIST/ Translates all occurrences of the characters found in the search list with the corresponding character in the replacement list. It returns ! the number of characters replaced. If no string is specified via the ! @samp{=~} or @samp{!~} operator, the @samp{$_} string is translated. ! (The string specified with @samp{=~} must be a scalar variable, an array ! element, or an assignment to one of those, i.e. an lvalue.) For ! @code{sed} devotees, @code{y} is provided as a synonym for @code{tr}. Examples:@refill @example --- 3849,3880 ---- @findex y/SEARCHLIST/REPLACEMENTLIST/ Translates all occurrences of the characters found in the search list with the corresponding character in the replacement list. It returns ! the number of characters replaced or deleted. If no string is specified ! via the @samp{=~} or @samp{!~} operator, the @samp{$_} string is ! translated. (The string specified with @samp{=~} must be a scalar ! variable, an array element, or an assignment to one of those, i.e. an ! lvalue.) For @code{sed} devotees, @code{y} is provided as a synonym for ! @code{tr}. ! ! If the @samp{c} modifier is specified, the @var{SEARCHLIST} character ! set is complemented. If the @samp{d} modifier is specified, any ! characters specified by @var{SEARCHLIST} that are not found in ! @var{REPLACEMENTLIST} are deleted. (Note that this is slightly more ! flexible than the behavior of some @code{tr} programs, which delete ! anything they find in the @var{SEARCHLIST}, period.) If the @samp{s} ! modifier is specified, sequences of characters that were translated to ! the same character are squashed down to 1 instance of the ! character.@refill ! @c maybe add more description on s modifier and examples for tr///cds ! ! If the @samp{d} modifier was used, the @var{REPLACEMENTLIST} is always ! interpreted exactly as specified. Otherwise, if the ! @var{REPLACEMENTLIST} is shorter than the @var{SEARCHLIST}, the final ! character is replicated till it is long enough. If the ! @var{REPLACEMENTLIST} is null, the @var{SEARCHLIST} is replicated. The ! latter is useful for counting characters in a class, or for squashing ! character sequences in a class.@refill ! Examples:@refill @example *************** *** 3867,3877 **** @cindex @code{y/SEARCHLIST/REPLACEMENTLIST/} example $ARGV[1] =~ y/A-Z/a-z/; # canonicalize to lower case ! $cnt = tr/*/*/; # count the stars in $_ ($HOST = $host) =~ tr/a-z/A-Z/; y/\001-@@[-_@{-\177/ /; # change non-alphas to space @end example @end table --- 3886,3905 ---- @cindex @code{y/SEARCHLIST/REPLACEMENTLIST/} example $ARGV[1] =~ y/A-Z/a-z/; # canonicalize to lower case ! $cnt = tr/*/*/; # count the stars in $_ ! ! $cnt = tr/0-9//; # count the digits in $_ + tr/a-zA-Z//s; # bookkeeper -> bokeper + ($HOST = $host) =~ tr/a-z/A-Z/; y/\001-@@[-_@{-\177/ /; # change non-alphas to space + # (before the c & s modifiers) + y/a-zA-Z/ /cs; # change non-alphas to single space + # (version 3.0 patchlevel 40+) + + tr/\200-\377/\0-\177/; # delete 8th bit @end example @end table *************** *** 3881,3886 **** --- 3909,3927 ---- @cindex System Interaction @table @asis + @item alarm(@var{SECONDS}) + @itemx alarm @var{SECONDS} + @findex alarm + @cindex @code{alarm} function + @cindex Timers, @code{alarm} function + Arranges to have a @samp{SIGALRM} delivered to this process after the + specified number of seconds (minus 1, actually) have elapsed. Thus, + @code{alarm(15)} will cause a @samp{SIGALRM} at some point more than 14 + seconds in the future. Only one timer may be counting at once. Each + call disables the previous timer, and an argument of 0 may be supplied + to cancel the previous timer without starting a new one. The returned + value is the amount of time remaining on the previous timer.@refill + @item chroot(@var{FILENAME}) @itemx chroot @var{FILENAME} @itemx chroot *************** *** 3899,3914 **** @cindex @code{die} function @cindex Exitting perl script @findex die ! Prints the value of @var{LIST} to @samp{STDERR} and exits with the ! current value of @samp{$!} (errno). As of version 3.0 patchlevel 27, ! @code{die} without @var{LIST} specified is equivalent to @example die 'Died'; @end example If @samp{$!} is 0, exits with the value of @samp{($? >> 8)} (`command` ! status). If @samp{($? >> 8)} is 0, exits with 255. Equivalent ! examples:@refill @example @cindex Example of @code{die} function @cindex @code{die} function example --- 3940,3960 ---- @cindex @code{die} function @cindex Exitting perl script @findex die ! Outside of an @code{eval}, prints the value of @var{LIST} to ! @samp{STDERR} and exits with the current value of @samp{$!} (errno). As ! of version 3.0 patchlevel 27, @code{die} without @var{LIST} specified is ! equivalent to@refill @example die 'Died'; @end example If @samp{$!} is 0, exits with the value of @samp{($? >> 8)} (`command` ! status). If @samp{($? >> 8)} is 0, exits with 255. Inside an ! @code{eval}, the error message is stuffed into @samp{$@@} and the ! @code{eval} is terminated with the undefined value.@refill + @noindent + Equivalent examples: + @example @cindex Example of @code{die} function @cindex @code{die} function example *************** *** 4284,4290 **** @cindex @code{syscall} function example require 'syscall.ph'; # may need to run h2ph @c @@@@ maybe should note that b4 pl27 h2ph was called makelib @@@@ - @c @@@@ makelib is now h2ph @@@@ orig man pg problem pl27 syscall(&SYS_write, fileno(STDOUT), "hi there\n", 9); @end example --- 4330,4335 ---- *************** *** 4807,4813 **** @item time @cindex @code{time} function @findex time ! Returns the number of non-leap seconds since January 1, 1970, UTC. Suitable for feeding to @code{gmtime()} and @code{localtime()}.@refill @end table --- 4852,4858 ---- @item time @cindex @code{time} function @findex time ! Returns the number of non-leap seconds since 00:00:00 UTC, January 1, 1970. Suitable for feeding to @code{gmtime()} and @code{localtime()}.@refill @end table *************** *** 5361,5374 **** program, so that any variable settings, subroutine or format definitions remain afterwards. The value returned is the value of the last expression evaluated, just as with subroutines. If there is a syntax ! error or runtime error, a null string is returned by eval, and @samp{$@@} ! is set to the error message. If there was no error, @samp{$@@} is null. ! If @var{EXPR} is omitted, evaluates @samp{$_}. The final semicolon, if ! any, may be omitted from the expression.@refill ! ! Note that, since eval traps otherwise-fatal errors, it is useful for ! determining whether a particular feature (such as @code{dbmopen} or ! @code{symlink}) is implemented.@refill @item ord(@var{EXPR}) @itemx ord @var{EXPR} --- 5406,5422 ---- program, so that any variable settings, subroutine or format definitions remain afterwards. The value returned is the value of the last expression evaluated, just as with subroutines. If there is a syntax ! error or runtime error, or a @code{die} statement is executed, an ! undefined value is returned by @code{eval}, and @samp{$@@} is set to the ! error message. If there was no error, @samp{$@@} is guaranteed to be a ! null string. If @var{EXPR} is omitted, evaluates @samp{$_}. The final ! semicolon, if any, may be omitted from the expression.@refill ! ! Note that, since @code{eval} traps otherwise-fatal errors, it is useful ! for determining whether a particular feature (such as @code{dbmopen} or ! @code{symlink}) is implemented. If is also @emph{Perl}'s exception ! trapping mechanism, where the @code{die} operator is used to raise ! exceptions.@refill @item ord(@var{EXPR}) @itemx ord @var{EXPR} *************** *** 5479,5485 **** left && left | ^ left & ! nonassoc == != eq ne nonassoc < > <= >= lt gt le ge nonassoc chdir exit eval reset sleep rand umask nonassoc -r -w -x etc. --- 5527,5533 ---- left && left | ^ left & ! nonassoc == != <=> eq ne cmp nonassoc < > <= >= lt gt le ge nonassoc chdir exit eval reset sleep rand umask nonassoc -r -w -x etc. *************** *** 6261,6267 **** that it can assume that strings contain a single line, for the purpose of optimizing pattern matches. Pattern matches on strings containing multiple newlines can produce confusing results when @samp{$*} is 0. ! Default is 0. (Mnemonic: @samp{*} matches multiple things.)@refill @item $0 Contains the name of the file containing the @emph{perl} script being --- 6309,6318 ---- that it can assume that strings contain a single line, for the purpose of optimizing pattern matches. Pattern matches on strings containing multiple newlines can produce confusing results when @samp{$*} is 0. ! Default is 0. Note that this variable only influences the ! interpretation of @samp{^} and @samp{$}. A literal newline can be ! searched for even when @samp{$* == 0}. (Mnemonic: @samp{*} matches ! multiple things.)@refill @item $0 Contains the name of the file containing the @emph{perl} script being *************** *** 6611,6616 **** --- 6662,6671 ---- When in doubt, parenthesize. At the very least it will let some poor schmuck bounce on the @kbd{%} key in @emph{vi}.@refill + Even if you aren't in doubt, consider the mental welfare of the person + who has to maintain the code after you, and who will probably put parens + in the wrong place.@refill + @item Don't go through silly contortions to exit a loop at the top or the bottom, when @emph{perl} provides the @code{last} operator so you can exit in the *************** *** 7793,7798 **** --- 7848,7857 ---- ''' 3.0 baseline ''' ''' $Log: perl.man.2,v $ + ''' Revision 3.0.1.10 90/11/10 01:46:29 lwall + ''' patch38: random cleanup + ''' patch38: added alarm function + ''' ''' Revision 3.0.1.9 90/10/15 18:17:37 lwall ''' patch29: added caller ''' patch29: index and substr now have optional 3rd args *************** *** 7827,7832 **** --- 7886,7895 ---- ''' 3.0 baseline ''' ''' $Log: perl.man.3,v $ + ''' Revision 3.0.1.11 90/11/10 01:48:21 lwall + ''' patch38: random cleanup + ''' patch38: documented tr///cds + ''' ''' Revision 3.0.1.9 90/10/16 10:02:43 lwall ''' patch29: you can now read into the middle string ''' patch29: index and substr now have optional 3rd args ------------------------------ From: gorpong@ping.uucp (Gordon C. Galligher) Subject: Re: Need help with (\d+) problem (s/...(\d+)/$1/ not working?) Date: 10 Nov 90 16:07:20 GMT In article <1990Nov4.224658.21882@uvaarpa.Virginia.EDU> telxon!ping!gorpong@uunet.uu.net writes: |Something is a little strange either with the way that I am interpreting the |manual page, or with Perl. The mini-script: [...confusion on \w+ mini-script deleted...] Thank you all very much for your help; as is normally the case you are right and I am stupid. Well, this is another case where TFM and I were not on the same wavelength. Of course the manual states that \w matches a word CHARACTER, not an entire word, and the + just tells it to match more than one word character; and that match would stop when a whitespace character came up. I may have been able to see it if I had really LOOKED at my output. I did not see the fact that "stuff\t95" had been replaced with 95; or I may have saved this group the trouble of this bandwidth. My apologies. Just as a quick aside, what I wanted to do was: REPLACE one or more words followed by one or more whitespace characters followed by one or more digits WITH just the digits Other than changing the s/// to m// and using $1 outside, is there any easy way to do that from within a =~ expression? (Did you recognize the s/\w+.../$1/ expression Larry? :-) -- Gordon. -- Gordon C. Galligher 9127 Potter Rd. #2E Des. Plaines, Ill. 60016-4881 ...!uunet!telxon!teleng!ping!gorpong ------------------------------ From: Dov Peter Grobgeld <CFGROB%WEIZMANN.BITNET@cunyvm.cuny.edu> Subject: Re: Perl-Users Digest #468 Reply-To: CFGROB%WEIZMANN.BITNET@cunyvm.cuny.edu Date: Sun, 11 Nov 90 07:36:24 GMT August which year did Michael Rendell write an MS-Dos version? 1897 seems a bit early? :-) (See patch #39)... ------------------------------ ** FOR YOUR REFERENCE ** The service addresses, to which questions about the list itself and requests to be added to or deleted from it should be directed, are as follows: Internet: Perl-Users-Request@Virginia.EDU Perl-Users-Request@uvaarpa.Virginia.EDU BITNET: Perl-Req@Virginia UUCP: ...!uunet!virginia!perl-users-request You can send mail to the entire list (and comp.lang.perl) via one of these addresses: Internet: Perl-Users@Virginia.EDU Perl-Users@uvaarpa.Virginia.EDU BITNET: Perl@Virginia UUCP: ...!uunet!virginia!perl-users End of Perl-Users Digest ******************************
fwp1@cc.msstate.edu (Frank W. Peters) (11/12/90)
Hmmm...your mailing list appears to be broken. Its sending its digest back to the news group via some mechanism. FWP