Newsgroups: fj.lang.perl
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!aist-nara!odins-suita!chiba-ns!news.chiba-u.ac.jp!eclnews!nttarm!news
From: "K.Hiraga" <box@mxa.meshnet.or.jp>
Subject: Re: [Q] How to use array as an argument for a subroutine
Content-Type: text/plain; charset=iso-2022-jp
Message-ID: <32B0BE51.71A2@mxa.meshnet.or.jp>
Sender: news@nttarm.ntt.jp (News Administrator)
Content-Transfer-Encoding: 7bit
Organization: K.Hiraga
References: <32A7D080.5506@mxa.meshnet.or.jp> <32ACD31A.45BA@mxa.meshnet.or.jp>
Mime-Version: 1.0
Date: Fri, 13 Dec 1996 02:24:17 GMT
X-Mailer: Mozilla 2.02 [ja] (Win95; I)
Lines: 66
Xref: galaxy.trc.rwcp.or.jp fj.lang.perl:1543
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.lang.perl&nb=1543&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

> $B2<5-$N$H$*$j$G$-$^$7$?!#(B
> 
> $B!J8m$^$jEy$"$j$^$7$?$i!"$4;XE&$$$?$@$1$l$P9,$$$G$9!K(B

$B0BED$5$s$+$i!"%a!<%k$G$NCzG+$J@bL@$r$$$?$@$-$^$7$?!#(B

# $B$"$j$,$H$&$4$6$$$^$7$?!#(B

$B0J2<!"8m$^$j$ND{@5$H!"$h$j$-$l$$$J%3!<%G%#%s%0$G$9!#(B


#############################################################
#! /usr/local/bin/perl

sub d_and_f {
local($l_dir, *l_dirs, *l_files, *l_nd, *l_nf) = @_;
#    @l_dirs[0] = 10; $B8m$^$j(B
#    @l_dirs[1] = 20; $B8m$^$j(B
$l_dirs[0] = 10;
$l_dirs[1] = 20;
$l_nd = 2;
}

&d_and_f($dir, *dirs, *files, *nd, *nf);
for($i=0; $i<$nd; $i++){
print "$i $dirs[$i]\n";
}
#############################################################


>>$#dirs $B$d(B $#files $B$G$=$l$>$l$N%"%l%$$N(B
>>$B:G8e$N1h$(;z$,$o$+$kLu$G$9$+$i(B,

>>$B$"$k$$$O!"%"%l%$$r6/@)E*$K%9%+%i!<$GI>2A$9$k$H!"(B
>>$B%"%l%$$NMWAG$N8D?t$rJV$7$^$9$+$i!"(B

#############################################################
#! /usr/local/bin/perl

sub d_and_f_1 {
local($l_dir, *l_dirs, *l_files) = @_;
$l_dirs[0] = 10;
$l_dirs[1] = 20;
}

&d_and_f_1($dir, *dirs, *files);

print "# Ex. 1 ##################################\n";
for($i=0; $i<=$#dirs; $i++){
print "$i $dirs[$i]\n";
}

print "# Ex. 2 ##################################\n";
$nd=@dirs;
$nf=@files;
for($i=0; $i<$nd; $i++){
print "$i $dirs[$i]\n";
}

print "# Ex. 3 ##################################\n";
$i=0;
foreach $d (@dirs){
print "$i $d\n";
$i++;
}
#############################################################
