jgreely@oz.cis.ohio-state.edu (J Greely) (08/25/89)
In article <JV.89Aug24163706@mhres.mh.nl> jv@mh.nl (Johan Vromans) writes: >Using a regular expression in a match pattern seems to destroy the >usability of the "$`" (dollar-leftquote) variable: It's fixed in 3.0 alpha. My output was: $` = abc, $' = ghi $` = abc, $' = ghi $` = , $' = defghi $` = abcdef, $' = -=- J Greely (jgreely@cis.ohio-state.edu; osu-cis!jgreely)
jv@mh.nl (Johan Vromans) (08/25/89)
Perl version: $Header: perly.c,v 2.0.1.10 88/11/22 01:14:58 lwall Locked $ Patch level: 18 Using a regular expression in a match pattern seems to destroy the usability of the "$`" (dollar-leftquote) variable: $a = "abcdefghi"; printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /def/; printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /d.f/; printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /^abc/; printf "\$` = %s, \$' = %s\n", $`, $' if $a =~ /ghi$/; produces: $` = abc, $' = ghi $` = , $' = ghi <== $` should be "abc" $` = , $' = defghi <== could be correct... $` = , $' = <== $` should be "abcdef" -- johan -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{mcvax,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500 ------------------------ "Arms are made for hugging" -------------------------
tytso@athena.mit.edu (Theodore Y. Ts'o) (08/29/89)
In article <JGREELY.89Aug24151825@oz.cis.ohio-state.edu> J Greely <jgreely@cis.ohio-state.edu> writes: >It's fixed in 3.0 alpha. My output was: Do you know when perl 3.0 will be coming out? What sort of features does it have? (Slobber, slobber..... an avid and enthusiastic user of perl 2.0 awaits.... :-) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Theodore Ts'o bloom-beacon!mit-athena!tytso 3 Ames St., Cambridge, MA 02139 tytso@athena.mit.edu Everybody's playing the game, but nobody's rules are the same!
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (08/30/89)
In article <13900@bloom-beacon.MIT.EDU> tytso@athena.mit.edu (Theodore Y. Ts'o) writes: : Do you know when perl 3.0 will be coming out? What sort of features : does it have? : : (Slobber, slobber..... an avid and enthusiastic user of perl 2.0 : awaits.... :-) The beta will be coming out in a few days. I don't know what you're expecting, I only made a few changes... Here's the current change list: Changes to perl --------------- Apart from little bug fixes, here are the new features: Perl can now handle binary data correctly and has functions to pack and unpack binary structures into arrays or lists. You can now do arbitrary ioctl functions. You can do i/o with sockets and select. You can now write packages with their own namespace. You can now pass arrays and such to subroutines by reference. The debugger now has hooks in the perl parser so it doesn't get confused. The debugger won't interfere with stdin and stdout. New debugger commands: n Single step around subroutine call. l min+incr List incr+1 lines starting at min. l List incr+1 more lines. l subname List subroutine. b subname Set breakpoint at first line of subroutine. S List subroutine names. D Delete all breakpoints. A Delete all line actions. V package List all variables in a package. < command Define command before prompt. > command Define command after prompt. ! number Redo command (default previous command). ! -number Redo numberth to last command. h -number Display last number commands (default all). p expr Same as \"print DBout expr\". The rules are more consistent about where parens are needed and where they are not. In particular, unary operators and list operators now behave like functions if they're called like functions. There are some new quoting mechanisms: $foo = q/"'"'"'"'"'"'"/; # generalized single quote $foo = qq/"'"''$bar"''/; # generalized double quote $foo = <<'EOF' x 10; Why, it's the old here-is mechanism! EOF You can now work with array slices (note the initial @): @foo[1,2,3]; @foo{'Sun','Mon','Tue','Wed','Thu','Fri','Sat'} = (1,2,3,4,5,6,7); @foo{split} = (1,1,1,1,1,1,1); There's now a range operator that works in array contexts: for (1..15) { ... @foo[3..5] = ('time','for','all'); @foo{'Sun','Mon','Tue','Wed','Thu','Fri','Sat'} = 1..7; You can now reference associative arrays as a whole: %abc = %def; %foo = ('Sun',1,'Mon',2,'Tue',3,'Wed',4,'Thu',5,'Fri',6,'Sat',7); Associative arrays can now be bound to a dbm or ndbm file. Perl automatically caches references to the dbm file for you. An array or associative array can now be assigned to as part of a list, if it's the last thing in the list: ($a,$b,@rest) = split; An array or associative array may now appear in a local() list. local(%assoc); local(@foo) = @_; Array values may now be interpolated into strings: `echo @ARGV`; print "first three = @list[0..2]\n"; print "@ENV{keys(ENV)}"; ($" is used as the delimiter between array elements) Array sizes may be interpolated into strings: print "The last element is $#foo.\n"; Array values may now be returned from subroutines, evals, and do blocks. Lists of values in formats may now be arbitrary expressions, separated by commas. Subroutine names are now distinguished by prefixing with &. You can call subroutines without using do, and without passing any argument list at all: $foo = &min($a,$b,$c); $num = &myrand; You can use the new -u switch to cause perl to dump core so that you can run undump and produce a binary executable image. Alternately you can use the "dump" operator after initializing any variables and such. Perl now optimizes splits that are assigned directly to an array, or to a list with fewer elements than the split would produce, or that split on a constant string. Perl now optimizes on end matches such as /foo$/; Perl now recognizes {n,m} in patterns to match preceding item at least n times and no more than m times. Also recognizes {n,} and {n} to match n or more times, or exactly n times. If { occurs in other than this context it is still treated as a normal character. Perl now optimizes "next" to avoid unnecessary longjmps and subroutine calls. Perl now optimizes appended input: $_ .= <>; Substitutions are faster if the substituted text is constant, especially when substituting at the beginning of a string. This plus the previous optimization let you run down a file comparing multiple lines more efficiently. (Basically the equivalents of sed's N and D are faster.) Similarly, combinations of shifts and pushes on the same array are much faster now--it doesn't copy all the pointers every time you shift (just every n times, where n is approximately the length of the array plus 10, more if you pre-extend the array), so you can use an array as a shift register much more efficiently: push(@ary,shift(@ary)); or shift(@ary); push(@ary,<>); Perl now detects sequences of references to the same variable and builds switch statements internally wherever reasonable. The substr function can take offsets from the end of the string. The split function can return as part of the returned array any substrings matched as part of the delimiter: split(/([-,])/, '1-10,20') returns (1,'-',10,',',20) If you specify a maximum number of fields to split, the truncation of trailing null fields is disabled. Perl now uses /bin/csh to do filename globbing, if available. This means that filenames with spaces or other strangenesses work right. Perl can now report multiple syntax errors with a single invocation. Perl syntax errors now give two tokens of context where reasonable. Perl will now report the possibility of a runaway multi-line string if such a string ends on a line with a syntax error. The assumed assignment in a while now works in the while modifier as well as the while statement. Perl can now warn you if you use numeric == on non-numeric string values. New functions: mkdir and rmdir getppid getpgrp and setpgrp getpriority and setpriority chroot ioctl and fcntl flock readlink lstat rindex - find last occurrence of substring pack and unpack - turn structures into arrays and vice versa read - just what you think warn - like die, only not fatal dbmopen and dbmclose - bind a dbm file to an associative array dump - do core dump so you can undump reverse - turns an array value end for end defined - does an object exist? undef - make an object not exist Changes to s2p -------------- In patterns, s2p now translates \{n,m\} correctly to {n,m}. In patterns, s2p no longer removes backslashes in front of |. In patterns, s2p now removes backslashes in front of [a-zA-Z0-9]. S2p now makes use of the location of perl as determined by Configure. Changes to a2p -------------- A2p can now accurately translate the "in" operator by using perl's new "defined" operator. A2p can now accurately translate the passing of arrays by reference. ------------------------------------------------ Larry Wall lwall@jpl-devvax.jpl.nasa.gov