[17743] in Perl-Users-Digest
Perl-Users Digest, Issue: 5163 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 20 18:10:38 2000
Date: Wed, 20 Dec 2000 15:10:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977353821-v9-i5163@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Dec 2000 Volume: 9 Number: 5163
Today's topics:
Re: launching an .exe file with exec() nobull@mail.com
Re: launching an .exe file with exec() stong123@my-deja.com
Passing parameters to a POST cgi script (Mark Culshaw)
Re: Passing parameters to a POST cgi script <tony_curtis32@yahoo.com>
Re: perl DBI <kent@darwin.eeb.uconn.edu>
Re: Ping CGI Script <russ_jones@rac.ray.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Mark W. Schumann)
Re: Probelm with Hash and loop <kstep@pepsdesign.com>
Re: Probelm with Hash and loop <joe+usenet@sunstarsys.com>
Re: Probelm with Hash and loop nobull@mail.com
referencing a scaler value as the modifier for a regex? <michael@datahost.com>
Re: referencing a scaler value as the modifier for a re <uri@sysarch.com>
Rename File in Win32 Environment <me@me.com>
Re: Rename File in Win32 Environment <jhelman@wsb.com>
Re: Rename File in Win32 Environment <kstep@pepsdesign.com>
Re: Rename File in Win32 Environment <soeder@ai-lab.fh-furtwangen.de>
Re: Rename File in Win32 Environment <peter.sundstrom@eds.com>
Storing A Directory Listing in an Array <!spammed@aye.net!>
Re: Storing A Directory Listing in an Array (Richard Zilavec)
Re: Storing A Directory Listing in an Array (Richard Zilavec)
Re: Storing A Directory Listing in an Array <extramail@home.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Dec 2000 20:14:19 +0000
From: nobull@mail.com
Subject: Re: launching an .exe file with exec()
Message-Id: <u9g0jizw84.fsf@wcl-l.bham.ac.uk>
stong123@my-deja.com writes:
> $dirname = "//minerva/global/setup/";
> opendir(DIR, $dirname) or die "$!";
> exec("set up1.exe") or die "$!";
> the executable is named 'set up1.exe' and is located in teh server's
> setup directory.
You are confusing opendir() with chdir().
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 20 Dec 2000 20:59:55 GMT
From: stong123@my-deja.com
Subject: Re: launching an .exe file with exec()
Message-Id: <91r6k6$m0m$1@nnrp1.deja.com>
Nobull,
Thanks for pointing that out!
In article <u9g0jizw84.fsf@wcl-l.bham.ac.uk>,
nobull@mail.com wrote:
> stong123@my-deja.com writes:
>
> > $dirname = "//minerva/global/setup/";
> > opendir(DIR, $dirname) or die "$!";
> > exec("set up1.exe") or die "$!";
>
> > the executable is named 'set up1.exe' and is located in teh server's
> > setup directory.
>
> You are confusing opendir() with chdir().
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 20 Dec 2000 22:03:45 GMT
From: mculshaw@uoguelph.ca (Mark Culshaw)
Subject: Passing parameters to a POST cgi script
Message-Id: <91rac1$72m$1@testinfo.cs.uoguelph.ca>
Hello All,
ok my dilema is as follows:
within a cgi script i am writing, i want to call another script, on another server,
and pass it parameters, BUT the other script is a 'POST' script instead of a GET script.
my question is:
is there a way to pass parameters to a 'POST' script on the
"command line/in one line of code", simmilar to a 'GET' script.
thanks
mark
------------------------------
Date: 20 Dec 2000 16:12:17 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Passing parameters to a POST cgi script
Message-Id: <87puimhhdq.fsf@limey.hpcc.uh.edu>
>> On 20 Dec 2000 22:03:45 GMT,
>> mculshaw@uoguelph.ca (Mark Culshaw) said:
> Hello All, ok my dilema is as follows:
> within a cgi script i am writing, i want to call another script, on
> another server, and pass it parameters, BUT the other script is a
> 'POST' script instead of a GET script.
> my question is:
> is there a way to pass parameters to a 'POST' script on the "command
> line/in one line of code", simmilar to a 'GET' script.
Nope.
But see
perldoc lwpcook
which will reveal all...
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: 20 Dec 2000 14:12:44 -0500
From: Kent Holsinger <kent@darwin.eeb.uconn.edu>
Subject: Re: perl DBI
Message-Id: <m0r932lxeb.fsf@darwin.eeb.uconn.edu>
>>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:
Randal> print table( map { Tr( map { td(escape_HTML($_)) } @$_ ) } @$two_d );
Very ingenious! I'm not as comfortable with map as I should be, so I
never would have thought of this.
Kent
--
Kent E. Holsinger kent@darwin.eeb.uconn.edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-3043
-- Storrs, CT 06269-3043
------------------------------
Date: Wed, 20 Dec 2000 13:50:42 -0600
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Ping CGI Script
Message-Id: <3A410D92.4574BC21@rac.ray.com>
Ben Turner wrote:
>
> Hi I have written the following script, which I want the generate an HTML
> page displaying the status of the machines at IP addresses kept in
> @host_array
>
> *******************
> use Net::Ping;
>
> $p = Net::Ping->new("icmp") or die "Can't Create New Ping Object: $!\n";
>
(snip)
> The problem comes when I run the script from a web server (in this case Peer
> Web Services on Windows 2000). The script takes 12+ seconds to display (the
> timeouts level for all for ping targets), and then reports that they are all
> 'NOT reachable'.
Are your execute permissions okay for your web server? On Unix, you
have to be running as root to use the icmp version of Net::Ping.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: 20 Dec 2000 17:54:16 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91rdao$ngd@junior.apk.net>
In article <slrn93v5s5.p3p.abigail@tsathoggua.rlyeh.net>,
Abigail <abigail@foad.org> wrote:
>Mark W. Schumann (catfood@apk.net) wrote on MMDCLXVII September MCMXCIII
>in <URL:news:91o3su$ek5@junior.apk.net>:
>|| In article <915gb3$bbg$1@bob.news.rcn.net>,
>|| Eric Bohlman <ebohlman@omsdev.com> wrote:
>|| > or c) will give you
>|| >a silly answer (e.g. one that works only for the exact sample input you
>|| >gave).
>||
>|| Which reminds me. Do we want a section on What To Do If Abigail Replies
>|| To Your Post?
>
>
>Well, what will you do?
I guess I for one would benefit from the aforementioned section.
------------------------------
Date: Wed, 20 Dec 2000 14:48:37 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: Probelm with Hash and loop
Message-Id: <91r2au$csb$1@slb6.atl.mindspring.net>
<msalerno@my-deja.com> wrote in message news:91qpfi$9un$1@nnrp1.deja.com...
> I am having problems creating a hash of users that match the $search
> var. I can do this with an array, but in order to do this properly I
> would like to use a hash. The information in the hash will later be
> used to print out a list. I am pretty sure that I will need to use a
> foreach loop in order to print out a list of all the users in the hash
> 30 at a time, but before I can battle with that, I need help with this
> issue. Any assistance is appreciated.
>
> Thanks,
> Matt
Looking at the code below, I would suggest reading the 'Red Flags' articles
by Mark-Jason Dominus at www.perl.com. Perl's built in list processing
features provide a more elegant syntax than the C-style for loops below.
> #!/usr/bin/perl -w
> use strict;
> use vars qw( $cnt $search %pwlist $o );
>
> $search = "oot";
>
> open(PASSWD, "</etc/passwd") || die "ERROR: Cannot open\n";
Good so far...
> my @pwq = <PASSWD>;
> $cnt = 0;
> for (my $i = 0; $i < @pwq; $i++)
> {
> if (lc($pwq[$i]) =~ /\Q$search/ ){
> my($user, $pword, $uid, $gid, $comment, $home, $shell) =
> split(/:/, $pwq[$i]);
You can eliminate the temporary array using the syntax below. Since this
only processes one line at a time, it will save resources on large files.
while (<PASSWD>) {
# Process the line
}
> %pwlist = ("$cnt" => ["$user", "$comment"]);
This line replaces %pwlist with a new hash containing a single element each
time that it is called, leaving only the last value that matched the if
statement above. What you need is:
$pwdlist{$cnt} = [$user, $comment];
Are you really interested in what order the user appears in the list? It
might be more interesting to key the hash by user name or UID:
$pwdlist{$user} = $comment;
$pwdlist{$uid} = [$user, $comment];
By the way, you do not need quotes around your variables - perl will
normally do what you want with strings or numbers, performing any necessary
conversions. Using quotes in this way can also have side effects if the
scalar contains something other than a number or a string:
my $obj = new SomeObject; # $obj is a reference to SomeObject
my $var = "$obj"; # $var contains the string
"SomeObject=HASH(0x1A2B3C4F)"
$var->func();
Perl will complain:
Can't locate object method "func" via package "SomeObject=HASH(0x1A2B3C4F)"
Below is a short program that reads some data, stores the user name and
comment in a hash, and prints the hash sorted by user name.
#!/usr/bin/perl -w
use strict;
my $search = "oot";
my %pwlist;
while (<DATA>) {
my($user, $comment) = (split /:/)[0,4]; # An array slice
if (lc($user) =~ /\Q$search/ ) {
$pwlist{$user} = $comment;
}
}
print "Found:\n";
print "User: $_\tComment: $pwlist{$_}\n" foreach sort keys %pwlist;
__DATA__
root:85Mz0be4ukiz.:1:1:Sysadmin:/:/bin/bash
user_a:qzqytOO3J9Q3I:92:2:user_a shell account:/home/user2:/bin/sh
user_b:G1C37evpYguXQ:96:7:user_b shell account:/home/user3:/bin/sh
smoot:ZiNK0oZVneOGg:53:1:smoot's shell account:/home/user4:/bin/csh
user_c:IzSiOuTv8xZis:74:1:user_c shell account:/home/user5:/bin/csh
If you're feeling adventurous, you can replace the while loop with the
construct below:
%pwlist = map {
$_->[0] => $_->[4]
} grep {
$_ = [split /:/];
$_->[0] =~ /\Q$search/;
} <DATA>;
HTH
Kurt Stephens
------------------------------
Date: 20 Dec 2000 14:55:41 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Probelm with Hash and loop
Message-Id: <m3itoekgua.fsf@mumonkan.sunstarsys.com>
msalerno@my-deja.com writes:
> I am having problems creating a hash of users that match
> the $search var. I can do this with an array, but in
> order to do this properly I would like to use a hash.
Using a hash is a good idea, but using sequential keys
like 0..30 isn't. (If you want them sequenced from 0, then
_do_ use an array.) You'll change that in the working
version, right?
> The information in the hash will later be used to print out
> a list. I am pretty sure that I will need to use a foreach
> loop in order to print out a list of all the users in the hash
> 30 at a time, but before I can battle with that, I need help
> with this issue. Any assistance is appreciated.
I'll comment on what you submitted- I hope it's ultimately helpful
for this.
>
> #!/usr/bin/perl -w
> use strict;
Perfect. A -T might also be nice since- users can
change their "comment" fields, and you might need to be
careful handling this data.
> use vars qw( $cnt $search %pwlist $o );
^^^ ^^
I don't like these names for global variables- I doubt you
really need other scripts to contend with these. See if
you can replace them with package variables:
my ($cnt, $search, %pwlist, $o); #still don't like $cnt and $o
> $search = "oot";
>
> open(PASSWD, "</etc/passwd") || die "ERROR: Cannot open\n";
Nice, but add $! to your error message also:
open(PASSWD, "</etc/passwd") || die "ERROR: Cannot open: $!";
> my @pwq = <PASSWD>;
> $cnt = 0; for (my $i = 0; $i < @pwq; $i++) {
>
> if (lc($pwq[$i]) =~ /\Q$search/ ){
No reason to read the entire file into the @pwq array when
you're only going to process it one item at a time and throw
away the @pwq array. Use a
while(<PASSWD>) {
# push @pwq, $_; # still want @pwq for later use
next unless /\Q$search/i;
construct instead (the line contents are in $_ now, and
unless you need the @pwq array, get rid of the commented
line altogether).
> my($user, $pword, $uid, $gid, $comment, $home, $shell) =
> split(/:/, $pwq[$i]);
> %pwlist = ("$cnt" => ["$user", "$comment"]);
You're reassigning the %pwlist hash each time, instead of
adding a hash key to it. This is probably the cause of your
problem. Try this instead
my ($user, undef, undef, undef, $comment) = split /:/ ;
$pwlist{$cnt} = [$user, $comment];
> $o = $i;
$o sucks- use a more descriptive variable name like
$last_linenum_matched = $. ;
Be careful with "$.", though- it's a _real_ global and can cause
trouble if used too far away from the "while(<PASSWD>)" line.
I'd move it up a few lines just to be safe :)
> print "$cnt\t$user\t$comment\n";
> print "Catalog # $cnt\tUser: $user\tComments: $comment\n";
> $cnt++;
> }
^ ^ ?
> }
>
> if ($cnt >= 1){
> print "HERE\n";
> print $pwlist{1}[0];
> }
^ ^ ?
In your original implementation, the only surviving key
is $cnt-1, hence $pwlist{1} only works if $cnt == 2.
I don't care much for the indentation on your closed brackets,
either. Nested blocks are too difficult to decipher. See
if you can fix that, along with your indentation in the last
block.
HTH.
--
Joe Schaefer
------------------------------
Date: 20 Dec 2000 20:11:35 +0000
From: nobull@mail.com
Subject: Re: Probelm with Hash and loop
Message-Id: <u9hf3yzwco.fsf@wcl-l.bham.ac.uk>
msalerno@my-deja.com writes:
> I am having problems creating a hash
I can never understand why this mistake comes up so often - typically
at least every other week or so.
%hash = ( $key => $value );
This assigns a value to %hash. In general, assigning a value to a
variable destroys any previous value. It replaces the whole of %hash
with a hash containing only a single entry.
$hash{$key} = $value;
This updates a single entry in %hash without effecting other
entries.
Of course if, as in your program, the keys of the hash are consecutive
integers starting at zero one has to ask why you used a hash rather
than an array.
I'll now go on to point out other mistakes:
> #!/usr/bin/perl -w
> use strict;
Very good so far.
> use vars qw( $cnt $search %pwlist $o );
Do you have a good reason for declaring each those as package
variables rather than lexicals in their respective minimal enclosing
scopes?
> $search = "oot";
Some people would criticise you for using " where ' would do. I won't :-)
> open(PASSWD, "</etc/passwd") || die "ERROR: Cannot open\n";
You forgot to include $! in the error message.
> my @pwq = <PASSWD>;
> $cnt = 0;
> for (my $i = 0; $i < @pwq; $i++)
Not very Perlish! One would usually say:
for my $i ( 0 .. $#pwq )
Or, since I doubt you really need $i:
for (@pwq)
Or even
while (<PASSWD>)
> {
>
> if (lc($pwq[$i]) =~ /\Q$search/ ){
Rather than lc() the string why not /i the pattern? Of course if
you've taken the above advice the variable will be $_ so the =~
binding clause can be ommited.
if ( /\Q$search/i ){
Or maybe:
if ( index(lc,$search) >= 0 ) {
> my($user, $pword, $uid, $gid, $comment, $home, $shell) =
> split(/:/, $pwq[$i]);
Again, if you use $_ as the variable it can be ommitted.
You only need to specify variable on the LHS if you intend to use it:
my ($user, undef, undef, undef, $comment ) = split /:/;
Or
my ($user, $comment) = (split /:/)[0,4];
> %pwlist = ("$cnt" => ["$user", "$comment"]);
You meant:
$pwlist{$cnt} = [ $user, $comment];
Note I've removed the redundant "" from all your variables.
Of course since $cnt is just an integer you'd be better off with an
array than with a hash:
$pwlist[$cnt] = [ $user, $comment];
And since $cnt is always one more than the last subscript it would be
even more Perlish to say:
push @pwlist => [ $user, $comment];
(The use of => rather than comma in push is my personal taste.)
> $o = $i;
I have no idea why you did that. Perhaps you did need $i after all.
> print "$cnt\t$user\t$comment\n";
> print "Catalog # $cnt\tUser: $user\tComments: $comment\n";
> $cnt++;
Of course using a simple array there's no need to keep a sepatate
$cnt variable, you can simply use scalar(@pwlist).
print "Catalog # " . scalar(@pwlist). "\tUser: $user\tComments: $comment\n";
Or, prehaps less readably:
print "Catalog # ${\scalar @pwlist}\tUser: $user\tComments: $comment\n";
> if ($cnt >= 1){
> print "HERE\n";
> print $pwlist{1}[0];
Huh? I think you meant 0 not 1 there since $cnt started at 0.
> }
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 20 Dec 2000 12:53:45 -0700
From: "Michael Stearns" <michael@datahost.com>
Subject: referencing a scaler value as the modifier for a regex?
Message-Id: <H4906.1265$lz1.289993@news.uswest.net>
Hello:
I am setting $s as follows:
if ($linebreaks eq "yes") {
$s="";
}
else {
$s="s";
}
Then later on in my script, I have this statement:
$text=~s^$find^$replace^$s;
How can I insert the value of $s as the modifier for this regular
expression?
Thanks for any suggestions,
-Michael
------------------------------
Date: Wed, 20 Dec 2000 21:20:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: referencing a scaler value as the modifier for a regex?
Message-Id: <x7ae9qeqmn.fsf@home.sysarch.com>
>>>>> "MS" == Michael Stearns <michael@datahost.com> writes:
MS> Then later on in my script, I have this statement:
MS> $text=~s^$find^$replace^$s;
MS> How can I insert the value of $s as the modifier for this regular
MS> expression?
you can't directly do that as it is a compile time option (unless you
use string eval but you shouldn't!). but your need has been anticipated
and you can insert regex option INSIDE the regex itself with (?$s)
assuming $s has the switches you want.
read perlre for more on this.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 20 Dec 2000 15:22:10 -0500
From: "Mike Mesarch" <me@me.com>
Subject: Rename File in Win32 Environment
Message-Id: <91r485$8es$1@sshuraab-i-1.production.compuserve.com>
rename($file, $newfile);
This doesn't work in a win32 environment. Does anyone have any other
recommendations?
Thanks!
-Mike
------------------------------
Date: Wed, 20 Dec 2000 21:01:01 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Rename File in Win32 Environment
Message-Id: <3A411E66.9750FD33@wsb.com>
Mike Mesarch wrote:
>
> rename($file, $newfile);
>
> This doesn't work in a win32 environment. Does anyone have any other
> recommendations?
That's odd. It works for me. The problem is most likely that one or
both of the variables that you are specifying is formatted incorrectly.
Post a bit more of the code that doesn't work (since it might also be a
permissions problem). As a test, make a file called Test.txt in the
C:\TEMP directory on your hard drive and then run the following:
rename('c:/temp/Test.txt', 'c:/temp/TestNew.txt');
If this doesn't work, then there is something seriously wrong with your
Perl installation.
> Thanks!
> -Mike
Hope this helps,
JH
------------------------------
Date: Wed, 20 Dec 2000 16:06:25 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: Rename File in Win32 Environment
Message-Id: <91r706$hbo$1@nntp9.atl.mindspring.net>
"Mike Mesarch" <me@me.com> wrote in message
news:91r485$8es$1@sshuraab-i-1.production.compuserve.com...
> rename($file, $newfile);
>
> This doesn't work in a win32 environment. Does anyone have any other
> recommendations?
> Thanks!
> -Mike
>
Try:
rename($file, $newfile) || die "Can't rename '$file' as '$newfile': $!";
The rename() function has worked on every Win32 build of perl that I've ever
used. Adding the error checking to your code will tell you why the call
failed, including the case where $file and $newfile don't contain what you
expect them to.
HTH
Kurt Stephens
------------------------------
Date: Wed, 20 Dec 2000 22:21:17 +0100
From: Oliver =?iso-8859-1?Q?S=F6der?= <soeder@ai-lab.fh-furtwangen.de>
Subject: Re: Rename File in Win32 Environment
Message-Id: <3A4122CD.BAED3958@ai-lab.fh-furtwangen.de>
Depp!
system(ren PATH\file1.fls PATH\file2.fls
------------------------------
Date: Thu, 21 Dec 2000 10:25:50 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Rename File in Win32 Environment
Message-Id: <91r84u$gl5$1@hermes.nz.eds.com>
Mike Mesarch <me@me.com> wrote in message
news:91r485$8es$1@sshuraab-i-1.production.compuserve.com...
> rename($file, $newfile);
>
> This doesn't work in a win32 environment. Does anyone have any other
> recommendations?
perldoc File::Copy
------------------------------
Date: Wed, 20 Dec 2000 16:45:04 -0500
From: "Some_Indiana_Guy" <!spammed@aye.net!>
Subject: Storing A Directory Listing in an Array
Message-Id: <t42a33mheaiqe9@corp.supernews.com>
I am writing a program that stores all file names
in a directory in an array. It will mail each file in the
array to an internet email address. It will then delete
all the files in the directory. This script will be set as
cron job to run every hour. This will be ran on a FreeBSD
UNIX system. I'm pretty sure i can pull this off once i
can find a function to store only the filenames in an array.
I'm pretty new to PERL so i've been having trouble finding
such a function. If anyone can point me in the right direction
i would appreciate it greatly.
-Aaron
------------------------------
Date: Wed, 20 Dec 2000 22:55:37 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Storing A Directory Listing in an Array
Message-Id: <3a41388c.190340917@news.tcn.net>
On Wed, 20 Dec 2000 16:45:04 -0500, "Some_Indiana_Guy"
<!spammed@aye.net!> wrote:
>I am writing a program that stores all file names
>in a directory in an array. It will mail each file in the
>array to an internet email address. It will then delete
>all the files in the directory. This script will be set as
>cron job to run every hour. This will be ran on a FreeBSD
>UNIX system. I'm pretty sure i can pull this off once i
>can find a function to store only the filenames in an array.
>I'm pretty new to PERL so i've been having trouble finding
>such a function. If anyone can point me in the right direction
>i would appreciate it greatly.
>
>-Aaron
>
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Wed, 20 Dec 2000 22:57:05 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Storing A Directory Listing in an Array
Message-Id: <3a4238ef.190440234@news.tcn.net>
On Wed, 20 Dec 2000 16:45:04 -0500, "Some_Indiana_Guy"
<!spammed@aye.net!> wrote:
>I am writing a program that stores all file names
>in a directory in an array. It will mail each file in the
>array to an internet email address. It will then delete
>all the files in the directory. This script will be set as
>cron job to run every hour. This will be ran on a FreeBSD
>UNIX system. I'm pretty sure i can pull this off once i
>can find a function to store only the filenames in an array.
>I'm pretty new to PERL so i've been having trouble finding
>such a function. If anyone can point me in the right direction
>i would appreciate it greatly.
perldoc -f opendir
This opens a directory, then use readdir, telldir, seekdir, rewinddir
closedir......
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Wed, 20 Dec 2000 23:03:43 GMT
From: Joel Nelson <extramail@home.com>
Subject: Re: Storing A Directory Listing in an Array
Message-Id: <3A413AF0.997C2907@home.com>
Some_Indiana_Guy wrote:
> I am writing a program that stores all file names
> in a directory in an array. It will mail each file in the
> array to an internet email address. It will then delete
> all the files in the directory. This script will be set as
> cron job to run every hour. This will be ran on a FreeBSD
> UNIX system. I'm pretty sure i can pull this off once i
> can find a function to store only the filenames in an array.
> I'm pretty new to PERL so i've been having trouble finding
> such a function. If anyone can point me in the right direction
> i would appreciate it greatly.
>
> -Aaron
See perlfunc section of perl documentation for 'opendir','readdir' and
'push'!
:-)
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 5163
**************************************