X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl.man.4;h=0fd5983c4b3163e758d81f28ae4dbb4e712aabaf;hb=79a0689e17f959bdb246dc37bbbbfeba4c2b3b56;hp=2843c20215ebd25a582c828d8e663c91a0e82be3;hpb=ff2452de34aca0717369277df00e15764613e5c1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perl.man.4 b/perl.man.4 index 2843c20..0fd5983 100644 --- a/perl.man.4 +++ b/perl.man.4 @@ -1,7 +1,10 @@ ''' Beginning of part 4 -''' $Header: perl.man.4,v 3.0.1.5 90/02/28 18:01:52 lwall Locked $ +''' $Header: perl.man.4,v 3.0.1.6 90/03/12 16:54:04 lwall Locked $ ''' ''' $Log: perl.man.4,v $ +''' Revision 3.0.1.6 90/03/12 16:54:04 lwall +''' patch13: improved documentation of *name +''' ''' Revision 3.0.1.5 90/02/28 18:01:52 lwall ''' patch9: $0 is now always the command name ''' @@ -211,7 +214,7 @@ of it rather than working with a local copy. In perl you can refer to all the objects of a particular name by prefixing the name with a star: *foo. When evaluated, it produces a scalar value that represents all the objects -of that name. +of that name, including any filehandle, format or subroutine. When assigned to within a local() operation, it causes the name mentioned to refer to whatever * value was assigned to it. Example: @@ -243,6 +246,11 @@ The * mechanism will probably be more efficient in any case. Since a *name value contains unprintable binary data, if it is used as an argument in a print, or as a %s argument in a printf or sprintf, it then has the value '*name', just so it prints out pretty. +.Sp +Even if you don't want to modify an array, this mechanism is useful for +passing multiple arrays in a single LIST, since normally the LIST mechanism +will merge all the array values so that you can't extract out the +individual arrays. .Sh "Regular Expressions" The patterns used in pattern matching are regular expressions such as those supplied in the Version 8 regexp routines. @@ -1221,7 +1229,7 @@ For example: .ne 4 system "echo $foo"; # Insecure - system "echo", $foo; # Secure (doesn't use sh) + system "/bin/echo", $foo; # Secure (doesn't use sh) system "echo $bar"; # Insecure system "echo $abc"; # Insecure until PATH set