[8591] in Perl-Users-Digest
Perl-Users Digest, Issue: 2208 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 30 11:18:05 1998
Date: Mon, 30 Mar 98 08:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 30 Mar 1998 Volume: 8 Number: 2208
Today's topics:
Re: (Q)Setuid and FindBin (Jason Gloudon)
Re: (Q)Setuid and FindBin (Andrew M. Langmead)
Re: Getopt::Long seemingly incompatible with 'use stric (Andrew M. Langmead)
How to conditionally put 'use OLE' in script which can (Wing Choy)
Re: Is there a "Newsgroup" for Newbies to Perl? (I R A Aggie)
Re: Is there a "Newsgroup" for Newbies to Perl? (I R A Aggie)
Is there a function File:Diff available ? <burkhard.kiesel@med.siemens.de>
Re: Macperl tchurch@gmu.edu
Re: Macperl tchurch@gmu.edu
Re: Need help with "shared memory" module IPC::Shareabl <captain@pirate.de>
OLE Automation with Excel Example Required (Graeme Hutcheon)
Perl and libc6 <pendleta@reston.carsoninc.com>
Re: Perl ong NT 4.0 <ponnuraj@yahoo.com>
Perl, Access 97, ODBC, Database help for a newbee. <webk@RemoveThisPart.yahoo.com>
Re: Perl, Access 97, ODBC, Database help for a newbee. <jim.michael@gecm.com>
Re: Ping <jamesr@aethos.co.uk.nospam>
Re: Ping (M.J.T. Guy)
Re: proposal: while $line (<FILE>) (Bernie Cosell)
Question <gking@no-spam.c-com.net>
Re: request HELP setting ISAPI Perl's @INC array (Andy Lester)
Re: Rotating HTML using Perl (Abigail)
Scalar Variable as an array name (Mitch Lyman)
Re: Scalar Variable as an array name <ponnuraj@yahoo.com>
Re: Searching a word in files <beske@worldnet.att.net>
Re: Suppressing "used only once" (Andy Lester)
URGENT PROBLEM! Who cares? (Andy Lester)
Re: using quot in Net::FTP to chmod <gbarr@ti.com>
What does "UNIX" stand for.. (Will Morse)
Re: what is cgi_auto_file? (Andrew M. Langmead)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 30 Mar 1998 14:02:44 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: (Q)Setuid and FindBin
Message-Id: <slrn6hv9dh.ctt.jgloudon@manitoba.bbn.com>
Jonathan Feinberg <jdf@pobox.com> wrote:
>I'd like other users to be able to restart and kill a server that I've
>written. Toward that end I've created a couple of scripts. It's my
>understanding that in order for others to kill a process that I own,
>the killing process must be run setuid me.
.
.
>When I flip the setuid bit of the script, FindBin acts bizarre, to
.
.
> jonathan$ ./stop_server
> Cannot find current script '/dev/fd/4' at /usr/local/lib/perl5/FindBin.pm line 185
> BEGIN failed--compilation aborted at /usr/local/lib/perl5/FindBin.pm line 185.
> BEGIN failed--compilation aborted at /dev/fd/4 line 4.
As `man perlsec`, explains, on some systems, setuid scripts are passed to
the interpreter (in this case perl) as /dev/fdn. Because of this, FindBin
cannot find the file being executed.
Since, if this is a setuid executable you should -not- use path names that
come from the environment in which your script is running, although tainting
checks should prevent you from doing something explicity insecure. This is
a case where you want to hardcode the paths to external files your script
depends on, or use a setuid wrapper like the one mentioned in the `perlsec`
manpage.
--
Jason Gloudon
------------------------------
Date: Mon, 30 Mar 1998 14:28:20 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: (Q)Setuid and FindBin
Message-Id: <EqMyv8.Dt8@world.std.com>
Jonathan Feinberg <jdf@pobox.com> writes:
> jonathan$ ./stop_server
> Cannot find current script '/dev/fd/4' at /usr/local/lib/perl5/FindBin.pm line 185
Your operating system is using a method for making setuid scripts
secure that prevents FindBin form being able to access the name of the
script.
Since there is is a small chance of changing a file between when the
kernel was passed the filename and when the interpreter opened the
file, many systems ignored the setuid bit for scripts. Then some
people came up with a better idea, have the kernel open the file, and
pass the name of the open file descriptor to the
interpreter. Unfortunately, this messes up the unix convention of
having the C environments "argv[0]" hold the program name (and it
already was a weak convention anyway.)
So basically, FindBin will never be able to find the script's name,
because the kernel is intentionally hiding it.
Some solutions that I can think of:
Hardcode the pathname in the script. Maybe use MakeMaker to create a
Makefile that will put the proper path to the script at installation
time. For security reasons, you may want to ensure that the name in
your script is not a symbolic link before you use it in the exec().
Don't restart the server by exec()ing itself. Maybe wrap the entire
script into a loop and an eval {} and die on reception of the HUP
signal. All lexical variables will go out of scope, destructors will
be called, etc. and then the loop will start the entire script again.
--
Andrew Langmead
------------------------------
Date: Mon, 30 Mar 1998 15:03:03 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Getopt::Long seemingly incompatible with 'use strict'
Message-Id: <Eqn0H4.GJ9@world.std.com>
"nwi-tech" <nwi-tech@dircon.net> writes:
>When strict is specified, i must predeclare $opt_file, or the script will
>not execute; if i do, $opt_file is
>not defined, regardless of whether i specify anything on the command line.
You are misreading what "use strict" requires of you. If you use
"use strict 'vars'" in your script, you must:
1. Make the variable lexically scoped (my()) variable.
2. Fully qualify the variable with the package name.
3. Mark the variable as exempt from "use strict" errors with the "use
vars" pragma.
Since Getopt::Long exports a variable into your package, it is not
the lexically scoped variable you declare, and your variable is
masking the existance of the package variable.
If you skip declaring you lexically scoped variable, you can refer to
the one set by Getopt::Long by either saying:
if($main::opt_file)
or by saying:
use vars '$opt_file';
and then being able to use an adorned
if($opt_file)
Or you could use Getopt::Longs option linkage feature for specifying
where to store the results of its option processing.
my $opt_file; # lexical variable, visible only in this file.
# search for --file option a store result in my $opt_file variable.
my @optl = ('file=s', \$opt_file);
GetOptions @optl;
--
Andrew Langmead
------------------------------
Date: 30 Mar 1998 15:20:18 GMT
From: whc@mink.att.com (Wing Choy)
Subject: How to conditionally put 'use OLE' in script which can run either in Unix or Win?
Message-Id: <6fod7i$d9t@newsb.netnews.att.com>
I have a perl script which can I would like to run on both
Unix and PC. If I am running on a PC, I need to use the OLE
module.
Is there a way to put 'use OLE' conditionally inside a script?
In Unix the OLE module does not exist, but even though that
potion of the code is not executed, the compiler stills look
for the module and won't even compile.
I am sure there is a way to conditionally ask perl to use
certain modules. But I couldn't find it in the FAQ.
Thanks for any pointer.
Wing
------------------------------
Date: Mon, 30 Mar 1998 09:43:52 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <fl_aggie-3003980943530001@aggie.coaps.fsu.edu>
In article <6fkjo1$bbl$1@gaia.ns.utk.edu>, "Bob Gwynne"
<gwynne@utkux.utk.edu> wrote:
+ Get off it! Try to help people who want to learn to program.
I don't see anything at all wrong with determining the "people who want
to learn" being a subset of newbies who CONSULT THE FINE DOCUMENTATION
BEFORE POSTING TO USENET.
+ You are
+ obviously not a professional teacher; therefore, you should not attempt to
+ teach by writing, by advising newbies, or by conducting workshops and
+ classes. Stick to programming if you are a programmer.
Thank G*d Tom's not a professional teacher. "Professional" teachers seem
to have been a sleep at the switch for 20+ years, now...
Maybe that's why Johnny can't effectively use the books he's bought...he
simply doesn't know how to use the index or table of contents. Because
no one took the time to teach him...
A pity.
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>
------------------------------
Date: Mon, 30 Mar 1998 09:47:09 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <fl_aggie-3003980947090001@aggie.coaps.fsu.edu>
In article <6fmvai$o3t$1@flotsam.uits.indiana.edu>, James Hurd
<jhurd@ucs.indiana.edu> wrote:
+ Then is is impossible for a non-programmer to use Perl,
+ so this debate is actually as ridiculous as it initally appears.
Not so. Anyone can type:
% perl _script_name_
and get the predetermined actions that the script in question is supposed
to execute.
But in order to write that script, one has to be either a) a programmer,
or b) a programmer-in-training.
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>
------------------------------
Date: Mon, 30 Mar 1998 17:18:43 +0200
From: "Burkhard Kiesel" <burkhard.kiesel@med.siemens.de>
Subject: Is there a function File:Diff available ?
Message-Id: <6focur$eom$1@med-iss3.med.siemens.de>
Hi,
is there a Module called File:Diff available, where you get out the
difference between two files,
like the "unix diff command" ??
------------------------------
Date: Mon, 30 Mar 1998 07:21:54 -0600
From: tchurch@gmu.edu
Subject: Re: Macperl
Message-Id: <6fo67h$a3a$1@nnrp1.dejanews.com>
In article <1d6jnfg.1a6rwxakdmrq0N@slip166-72-108-221.ny.us.ibm.net>,
kpreid@ibm.net (Kevin Reid) wrote:
> Because it's MacPerl::DoAppleScript (note case).
Sorry, I actually have it right in the script, but since its on another
network, I couldn't do a cut and paste. The AppleScript works fine on my
machine, but does not work when I transfer the stand-alone to a different
machine. I checked my path and lib is in the path.
>
> > 2. Whenever the script exits, it leaves an instance of Macperl
running
> > under the finder(? top left corner list on the Mac). I would like
> > the application to shut down completely and not have this instance
> > running. Is this possible?
>
> Just call MacPerl::Quit().
>
I have tried putting k, MacPerl, and AlwaysQuit, and all combinations in the
parenthesies. I get a window with the message Dev::Pseudo in it and I still
have to kill the process by hand.
New question. Where in help is the DoAppleScript located. Using the hi-lite
and help on MacPerl I get some very terse descriptions about MacPerl::Quit,
but DoAppleScript is not even mentioned. Most of the rest of the available
help seems to be the same documentation as on a unix box.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 30 Mar 1998 07:53:22 -0600
From: tchurch@gmu.edu
Subject: Re: Macperl
Message-Id: <6fo7vi$bek$1@nnrp1.dejanews.com>
> Yes, but call MacPerl::Quit with the proper flag, and you can put the call
> right at the beginning of your script if you'd like. MacPerl::Quit does
> *not* force MacPerl to quit. It merely sets a flag telling it what to do
> when it hits a real or implied exit().
>
My confusion at this point was due to the response I got from the Perl help
function with MacPerl highlighted. Upon further reading I found reference to
the Macperl.html. But it is now MacPerl.pod, and contains the correct syntax.
Now all I have to do is figure out why the DoAppleScript does not function on
a different machine with a standalone Application. Could it be related to
Applscript extensions (as related to Perl, AppleScript is on that machine) not
being on the machine. I have the Inside book on order from Apple, I need to
find out more about Macs.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 30 Mar 1998 16:38:50 +0200
From: Mark Seuffert <captain@pirate.de>
To: Zenin <zenin@archive.rhps.org>
Subject: Re: Need help with "shared memory" module IPC::Shareable !
Message-Id: <351FAE7A.455B@pirate.de>
Thanks for your help.... but I think in modules the use of 'croak' to
handle run-time problems is very user unfriendly!!!!!
There are some reasons for me to think this is a bad style:
(plz tell me if I'm wrong)
1. U have to call all module functions with the try'n'catch method.
Would U also like to use normal perl functions as try'n'catch? Than U
have to open a file with
eval { open (FILE, $file) }; if ($@) { die "Can't open $file: $@\n" }
instead of open(FILE, $file) || die "Can't open $file: $!\n";
So why do module programmers make life more complicate, are they enemies
of Larry?
2. If U work with tied variables (like in module IPC::Shareable), U have
to 'eval' every time U work with these variables. Isn't that really
stupid?
At some points of my scripts I avoid 'eval' by catching now
$SIG{'__DIE__'} and try to find out if IPC:Sharable called an 'croak'.
zenin@archive.rhps.org wrote:
: No, sorry. IPC::Shareable looked good, but I could never get it to
: really play nice when I pushed it. I fell back to using sockets
: because I know them much better. -At least, until threads are
: stable. :-)
To make IPC::Shareable work I used the script below... maybe someone
could help me to make it better! If shared memory is working with perl
there is no need for some socket solutions. Who says perl can't do
complex multithreaded shared-memory applications (only the FAQ)... :)
Have a look on the following script....
I hope someone could make using IPC::Shareable easier?
--------- schnipp ---------
#!/usr/bin/perl -w
# A secure way (?) of using shared memory module IPC::Sharable
use IPC::Shareable;
%options = ( 'create' => 'yes', 'exclusive' => 'yes',
'mode' => 0600, 'destroy' => 'yes' );
$glue='tst1';
# Set up error handlers
sub catch_int { exit; } #Note: Catch any other signals like this
$SIG{INT} = \&catch_int;
sub catch_error { #This will handle if module calls a 'croak'
my $errortext = shift;
if ($errortext =~ /(shmctl|shmget|shmwrite|semget|semop) returned/) {
$errortext= "Shared memory failure\n";
### this die is called by the IPC::Sharable Modul
### maybe there is a better way to find out where the die is from?
### however, now u could handle the exit:
### write your log, shutdown an server, whatever U want...
}
die "$errortext";
}
$SIG{'__DIE__'} = \&catch_error;
# Create 'shared memory block' (try'n'catch)
eval { tie($scalar, IPC::Shareable, $glue, { %options }) };
if ($@) {
die "Can't get shared memory\n"
#here we could also try another $glue
}
# Work with tied varaibles (shared memory)
# If an error occurs, this will call an exit :(
# But our catch_error handels this :)
for($scalar=9;$scalar;$scalar--) {
print "$scalar\n"; # a stupid test
}
# Free our 'shared memory block' (try'n'catch)
eval { untie $scalar };
if ($@) { die "Can't free shared memory\n" }
print "OK\n";
--------- schnapp ---------
And now how it should be... *dreaming*
Even the IPC::Sharable examples does it like below, but remeber: it does
NOT work!
--------- schnipp ---------
#!/usr/bin/perl -w
# A way how IPC::Sharable will NOT work secure
use IPC::Shareable;
%options = ( 'create' => 'yes', 'exclusive' => 'yes',
'mode' => 0600, 'destroy' => 'yes' );
$glue='tst1';
$SIG{INT} = \&Exit_handler_to_shutdown_whatever;
# Create 'shared memory block' (try'n'catch)
tie($scalar, IPC::Shareable, $glue, { %options })
|| die "Can't get shared memory\n";
for($scalar=9;$scalar;$scalar--) {
print "$scalar\n"; # a stupid test
}
untie $scalar || die "Can't free shared memory\n"
print "OK\n";
--------- schnapp ---------
/Mark Seuffert (please email also as reply)
------------------------------
Date: 30 Mar 1998 15:24:01 GMT
From: Graeme.Hutcheon@nts.hl.siemens.de (Graeme Hutcheon)
Subject: OLE Automation with Excel Example Required
Message-Id: <6fodeh$lk4$1@mosquito.HL.Siemens.DE>
Hi
I would like to create a grep type function for excel.
I have a directory with a number of .XLS files and would like to
retrieve indivial matching records from them and print them out.
On asking if there is such a tool in the Excel conference
I was pointed to Perl Win32 OLE but so far I have been unsuccessful to
do anything but the most basic of things.
Could some kind person either post or send me an example of
excel ole automation to send me is the right direction as the
ones that come with the kit do not seem to tell me the whole story.
-Thanks in advance
Graeme
------------------------------
Date: Mon, 30 Mar 1998 10:39:57 -0500
From: "Adam H. Pendleton" <pendleta@reston.carsoninc.com>
Subject: Perl and libc6
Message-Id: <6foen0$514$1@clarknet.clark.net>
I am having problems getting Perl to pass it's test after installing gcc
2.8.1 and glibc 2. It only passes 83% of it's tests. Has anyone else had
this problem. I am running Linux 2.0.33 on an i386 platform
Adam Pendleton
------------------------------
Date: Mon, 30 Mar 1998 09:10:05 -0500
From: Raj Ponnuraj <ponnuraj@yahoo.com>
Subject: Re: Perl ong NT 4.0
Message-Id: <351FA7BD.573221F2@yahoo.com>
gso@orion.no wrote:
> I am trying to run a perl script on a nt ws 4.0.
> In the script i have: "use strict;" at line 1.
> When i trying to run the script i get the error:
> Can't locate strict.pm in @INC at test.pl line 1.
> What is wrong?
When installing Perl the process should add a bunchof values to the
registry HKEY_LOCAL_MACHINE/Software/ActiveWare/Perl5
Here PRIVLIB should point to the directory which contains the strict.pm
file.
This directory is usually c:\perl\lib. Please check if this is so...
Have fun,
Raj
------------------------------
Date: Mon, 30 Mar 1998 10:07:58 -0500
From: "Ken" <webk@RemoveThisPart.yahoo.com>
Subject: Perl, Access 97, ODBC, Database help for a newbee.
Message-Id: <6focg7$8br$1@proxye1.nycap.rr.com>
Is there a way to have a perl script read from a Access 97 database?
It would be even better if there was a way it could write to it too.
------------------------------
Date: Mon, 30 Mar 1998 10:22:19 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Perl, Access 97, ODBC, Database help for a newbee.
Message-Id: <351FB8AB.3896@gecm.com>
Ken wrote:
>
> Is there a way to have a perl script read from a Access 97 database?
> It would be even better if there was a way it could write to it too.
Check out the Win32 ODBC module http://www.perl.com/CPAN/. Search
dejanews on 'perl odbc access' and you should be able to turn up a few
examples of code in addition to the docs which come with the module.
Also pay attention to the version specific issues with this module.
NOTE: comp.perl.lang is a dead group, don't post there.
------------------------------
Date: 30 Mar 98 14:01:43 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: Ping
Message-Id: <01bd5be5$9f718fa0$26c0a4c1@kitkat.aethos.co.uk>
Tim Richter <Tim.Richter@Dresdner-Bank.Com> wrote
> Is it possible to do a "ping" to a host using only perl and not the
> system4s ping-command?
>
You can always use Net::Ping (In the standard distribution, if memory
serves me correctly, so (bonus!) you already have it!!!!!)
------------------------------
Date: 30 Mar 1998 14:33:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Ping
Message-Id: <6foaga$a89$1@lyra.csx.cam.ac.uk>
Tim Richter <Tim.Richter@Dresdner-Bank.Com> wrote:
>Hi.
>
>
>Is it possible to do a "ping" to a host using only perl and not the
>system4s ping-command?
>I want to watch some (1300) servers in the net and only need toknow if
>they are pingable. My current
>solution uses the os ping-command and is far to slow.
See the Net::Ping module contained in the standard distribution.
Mike Guy
------------------------------
Date: Mon, 30 Mar 1998 13:36:16 GMT
From: bernie@fantasyfarm.com (Bernie Cosell)
Subject: Re: proposal: while $line (<FILE>)
Message-Id: <351f9f25.311464946@nntp.infoave.net>
mike@stok.co.uk (Mike Stok) wrote:
} In article <351B32F3.19B4B6B8@negia.net>,
} Dan Boorstein <danboo@negia.net> wrote:
} >lately i've seen more and more mention of how:
} >
} > while (<FILE>) # reads a solitary 0 from the last line
} > # (i.e., magic 'defined')
} >
} >differs from:
} >
} > while ($line = <FILE>) # fails to read a solitary 0 from the last
} > # line (i.e., no magic 'defined')
} >
}
} Please note that the code is different, there's an extra $line = in the
} second example.
}
} Please note in the perlop man page:
}
} Evaluating a filehandle in angle brackets yields the next
} line from that file (newline, if any, included), or undef at
} end of file. Ordinarily you must assign that value to a
} variable, but there is one situation where an automatic
} assignment happens. If and ONLY if the input symbol is the
} only thing inside the conditional of a while or for(;;)
} loop, the value is automatically assigned to the variable
} $_. The assigned value is then tested to see if it is
} defined. (This may seem like an odd thing to you,
But notice that that's not very well written. In the last sentence, it
merely says "The assigned value". We all know that it *ONLY* means "the
assigned value in the automatic case", but the fact is that the way it is
written one could easily interpret that to mean after -either- assignment
method of the value is done...
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Mon, 30 Mar 1998 15:32:46 GMT
From: "Greg" <gking@no-spam.c-com.net>
Subject: Question
Message-Id: <yWOT.1905$69.1263532@news.giganews.com>
I have been reading a nifty Perl book and came across an interesting
question.
What is the result of
($a,$b) = ((1,2), 3);
print "$a $b";
well, it actually gives you:
1 2
But,
The way I read it, $a should be = (1,2) and $b = 3
The $a=2 and $b= 3
Thanks
Greg
gking at c - com . ## net ##
------------------------------
Date: 30 Mar 1998 15:42:42 GMT
From: petdance@maxx.mc.net (Andy Lester)
To: benton (benton@panix.com)
Subject: Re: request HELP setting ISAPI Perl's @INC array
Message-Id: <6foehi$9so$2@usenet11.supernews.com>
: The Difficulty is getting ISAPI Perl to load the correct @INC array.
You have to set the "PERL5LIB" environment variable. If you're under NT,
then that has to be set system-wide.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: 30 Mar 1998 15:45:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Rotating HTML using Perl
Message-Id: <6foen7$603$1@client3.news.psi.net>
Franco Finstad (ffinstad@best.com) wrote on MDCLXXI September MCMXCIII in
<URL: news:351ED257.FECFAB3B@best.com>:
++ I'd would like to have different text displayed each time my homepage is
++ loaded. I need the text to be read from a text file that I'm constantly
++ updating. Is this possible using Perl?
Yes.
(Do you have a question other than "write the program for me"?)
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 30 Mar 1998 13:56:58 GMT
From: ingrjml@bnr.ca (Mitch Lyman)
Subject: Scalar Variable as an array name
Message-Id: <6fo8ba$j9b@bcrkh13.bnr.ca>
Keywords: Scalar Variable Array Name Perl
Hi,
I have been working on this problem for a few days and have read
'Learning Perl', the Camel book, and the perl man pages.
I'm performing a push command.
push(@{$var},$temp);
$temp has a string with a value of 'P is a good tool which has improved'.
$var has a string name of 'Question2_Comments'.
But @{$var} is empty when i push the string on the array. I want push onto
the array with the end result being
@Question2_Comments = (Patchit is a good tool which has improved);
How do I do this using variables?
Below is the debug output
main::(test:28): push(@{$var},$temp);
DB<2> x $temp
0 "P is a good tool which has improved"
DB<3> x @{$var}
empty array
DB<4> x $var
0 'Question2_Comments'
DB<5> s
main::(test:25): $temp = $hash{$var};
DB<5> x @{$var}
empty array
Why will this syntax not work? According to my understanding of
the documentation this should work.
Regards,
Mitch
------------------------------
Date: Mon, 30 Mar 1998 10:11:32 -0500
From: Raj Ponnuraj <ponnuraj@yahoo.com>
Subject: Re: Scalar Variable as an array name
Message-Id: <351FB624.1B6BAAF3@yahoo.com>
Mitch Lyman wrote:
> Hi,
>
> I have been working on this problem for a few days and have read
> 'Learning Perl', the Camel book, and the perl man pages.
>
> I'm performing a push command.
>
> push(@{$var},$temp);
>
> $temp has a string with a value of 'P is a good tool which has improved'.
> $var has a string name of 'Question2_Comments'.
> But @{$var} is empty when i push the string on the array. I want push onto
> the array with the end result being
>
> @Question2_Comments = (Patchit is a good tool which has improved);
>
> How do I do this using variables?
If this is what you want to do, one way is to use eval, because you are trying
to create a variable at run time... (if I understand it right).
$temp = 'P is a good tool which has improved';
$var='a';
$buf="\@" . $var . "=\('$temp'\);";
eval $buf ;
print "Result:: " . join(':',@a) . "\n";
This appears to be an exotic problem..! You might want to redesign around
it...
Regards.
Raj
------------------------------
Date: Mon, 30 Mar 1998 09:18:57 -0500
From: Bryan Beske <beske@worldnet.att.net>
Subject: Re: Searching a word in files
Message-Id: <6fo9ls$hdf@bgtnsc02.worldnet.att.net>
Judging from your code, I assume you are on a U**X
platform. If so, try grep insead.
@files = `grep -i word ./*`;
Word of warning. If you are using U**X, the shell will expand
the system command wildcard and may blow chunks.
The really safe and portable way is to us the Perl File::xxx calls
to do directory reads and then us bulk reads with a large buffer
to grep through.
b^2
------------------------------
Date: 30 Mar 1998 15:44:44 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Suppressing "used only once"
Message-Id: <6foelc$9so$3@usenet11.supernews.com>
: > (($oldFoo, ... other unused variables in oldstuff ...)) if (0);
: use vars qw( $oldFoo, ... ) ;
But without the comma after $oldFoo.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: 30 Mar 1998 15:47:46 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: URGENT PROBLEM! Who cares?
Message-Id: <6foer2$9so$4@usenet11.supernews.com>
Why do people think I give Shit One about whether their problem is
"urgent" or not?
Why do they think that we'll be happier to answer their dumbass questions
because they tag it "URGENT!"?
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Mon, 30 Mar 1998 08:50:39 -0600
From: Graham Barr <gbarr@ti.com>
Subject: Re: using quot in Net::FTP to chmod
Message-Id: <351FB13F.5ADE748@ti.com>
Kelly Bond wrote:
>
> I've got a little script that FTPs files around various machines.
> After I do the ftp, I need to set file permissions and I thought I could do
> that like this:
>
> $ftp->quot('chmod',755,$filename)
>
> but this doens't work and I get:
> 'CHMOD 700 /path/to/file/filename.txt': command not understood
> in $ftp->message()
>
> Now I know I can issue this command from the command line in the ftp program
> and it works just fine, so I'm assuming I'm messing up the quot part of the
> code (which I am totally unfamiliar with).
>
> What am I doing wrong?
Some ftp servers support a command "site chmod" I can only
assume that what you type chmod into you ftp client that it
issues this command. However not all ftp servers will support
this command.
you can send this command using Net::FTP with
$ftp->quot('site chmod 755',$filename);
Graham.
--
Graham Barr <gbarr@ti.com>
Life would be so much easier if we could just look at the source code.
------------------------------
Date: Mon, 30 Mar 1998 15:10:11 GMT
From: wtm001@anadarko.com (Will Morse)
Subject: What does "UNIX" stand for..
Message-Id: <Eqn0sz.ExB@anadarko.com>
A lot of people have been adding urban myths to this
thread. Don't believe them!
As you may have noticed, that the various authors of Unix and
Unix utilities don't like to type and so that have named
all the commands and such with short cryptic names. For
instance "copy" is "cp","move" is "mv", and "ifconfig" is
"turn the internet functions on and off and change them".
Well, Unix is just the same, a short cryptic name. It
really stands for "UNInitialize X register". In some early
computers, the X register was used to keep track of the
amount of resources systems programmers consumed by playing
computer games such as "Space War" and "Hide the Weenie".
The Unix operating system was developed so that systems
programmers could set the X register to a large negative
number so that when their review came up, rather than
getting dinged for playing computer games, they actually
got a bonus for playing less than zero time!
<Attention humor impaired: It's a JOKE, dammit>
Will
------------------------------
Date: Mon, 30 Mar 1998 13:51:56 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: what is cgi_auto_file?
Message-Id: <EqMx6K.C2x@world.std.com>
Norman Katz <nkatz@cts.com> writes:
>I have perl5.003 installed on NT4 and I'm using IIS3.
>My Script Map in the registry does not have an entry
>for .cgi. However, my .cgi scripts execute fine.
>When I check file associations, cgi is associated with
>"cgi_auto_file." But, I can't find any references to this.
>Any clues what this means and how my .cgi scripts are
>actually executing?
Perl has no feature called a "cgi_auto_file" (I just searched through
the documentation to make sure.)
Maybe the newsgroup <URL:news:comp.infosystems.www.servers.ms-windows>
would be a better place to ask?
--
Andrew Langmead
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2208
**************************************