[13163] in Perl-Users-Digest
Perl-Users Digest, Issue: 573 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 18 11:08:09 1999
Date: Wed, 18 Aug 1999 08:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 18 Aug 1999 Volume: 9 Number: 573
Today's topics:
$$var[xxx] vs ${var}[xxx] <ebct@hotmail.com>
Re: $$var[xxx] vs ${var}[xxx] <jpeterson@office.colt.net>
Re: $$var[xxx] vs ${var}[xxx] <jcreed@cyclone.jprc.com>
Re: Array, Subroutine question <r.goeggel@atos-group.de>
Re: Connecting to UNC share via Perl/CGI <c4jgurney@my-deja.com>
Re: current dir in perl ? (David Pashley)
Re: current dir in perl ? <jdupayrat@webraska.com>
Re: current dir in perl ? (Bill Moseley)
Re: current dir in perl ? (Marcel Grunauer)
Re: DBI: prepare, and execute with placeholders - fails <mpeppler@peppler.org>
Re: djgpp, Win98, Perl, and serial port <eliz@is.elta.co.il>
Re: djgpp, Win98, Perl, and serial port (Bbirthisel)
Forking??? <bob.freedman@eis.noaa.gov>
Re: Forking??? <jpeterson@office.colt.net>
Re: Forking??? <markm@nortelnetworks.com>
Re: HARASSMENT -- Monthly Autoemail <lusol@Pandora.CC.Lehigh.EDU>
RE: Joining Two Integers (Larry Rosler)
Re: launching applications (Michel Dalle)
Numeric Formatting <djanisse@northrock.bm>
Re: Numeric Formatting <jpeterson@office.colt.net>
Re: Numeric Formatting (Marcel Grunauer)
passing file handles to a sub (michael j strong)
Re: passing file handles to a sub <cmcurtin@interhack.net>
Re: Pattern matching on command line thomasyeung@my-deja.com
Re: Perl HTML to txt kent@darwin.eeb.uconn.edu
Problems with Permissions, need some insight <pmt@top.mitre.org>
Re: Spell Checker (Bbirthisel)
splitting on unquoted commas <simon@profero.com>
Re: splitting on unquoted commas <garethr@cre.canon.co.uk>
Re: splitting on unquoted commas <crt@kiski.net>
Strange Error <jimmy@blackhole-designs.com>
Re: Strange Error <jpeterson@office.colt.net>
Re: Tab range extension <crt@kiski.net>
Re: Tab range extension (Gary O'Keefe)
Re: what does eq do on lists? (Larry Rosler)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Aug 1999 09:40:43 -0700
From: "Irwin M. Feuerstein" <ebct@hotmail.com>
Subject: $$var[xxx] vs ${var}[xxx]
Message-Id: <7ped4u$fgf$1@autumn.news.rcn.net>
I've read the pages, and I still don't get it. Can someone please tell me
(in very simple terms, please) what the difference is amongst:
$$var[xxx]
${$var}[xxx]
$${var}[xxx]
${${var}}[xxx]
Why aren't they the same thing?
Irwin
imfhome1@yahoo.com
------------------------------
Date: Wed, 18 Aug 1999 14:19:49 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: $$var[xxx] vs ${var}[xxx]
Message-Id: <9izu3.162$u07.1316@news.colt.net>
Irwin M. Feuerstein <ebct@hotmail.com> wrote:
> I've read the pages, and I still don't get it. Can someone please tell me
> (in very simple terms, please) what the difference is amongst:
> $$var[xxx]
The thingy that $var[xxx] is a reference to. @var is an array. $var[xxx] is a
particular element of @var, which we assume here contains a reference.
$$var[xxx] the thing (a scalar thing) that that reference refers to.
> ${$var}[xxx]
$var is a reference to an array. @{$var} is the array that $var references.
${$var}[xxx] is an the xxx'th element of that array. You will more frequently
see this written as $var->[xxx].
The -> dereferences the thing to its left. $var is a reference $var-> is the
thing referred to, $var->[xxx] is the xxx'th element of the thing refered to,
which we assume to be an array (it makes no sense otherwise).
> $${var}[xxx]
Ouch :-). The brackets are redundant here, and rather confusing. This is the
same as $$var[xxx].
> ${${var}}[xxx]
Are you doing this for fun? Is it a test? Unless I've got it wrong, this is
the same as ${$var}[xxx] and again, the inermost braces are redundant.
If I've got any of this wrong I'm sure to be corrected from several directions
at once...
> Why aren't they the same thing?
> Irwin
> imfhome1@yahoo.com
------------------------------
Date: 18 Aug 1999 10:34:25 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: $$var[xxx] vs ${var}[xxx]
Message-Id: <a1n1vpcg3y.fsf@cyclone.jprc.com>
Jon Peterson <jpeterson@office.colt.net> writes:
> Irwin M. Feuerstein <ebct@hotmail.com> wrote:
> > I've read the pages, and I still don't get it. Can someone please tell me
> > (in very simple terms, please) what the difference is amongst:
>
> > $$var[xxx]
>
> The thingy that $var[xxx] is a reference to. @var is an array. $var[xxx] is a
> particular element of @var, which we assume here contains a reference.
> $$var[xxx] the thing (a scalar thing) that that reference refers to.
What?
bash$ perl -w
$var = ['foo', 'bar', 'baz', 'mumble'];
print $$var[3], "\n";
__END__
mumble
bash$
I see no @var here.
perldoc perlref
---Jason
------------------------------
Date: Wed, 18 Aug 1999 16:54:43 +0200
From: Ronald Goeggel <r.goeggel@atos-group.de>
Subject: Re: Array, Subroutine question
Message-Id: <7pehit$rmv$1@news.pop-stuttgart.de>
Martien Verbruggen wrote:
>
>
> But it does matter when the sub has a prototype (like in the orignal
> example):
>
> # perl -wl
> @a = (1, 2, 3, 4);
> foo (@a);
> sub foo (\@) { print join '+', @_ }
> __END__
> 1+2+3+4
>
> # perl -wl
> a = (1, 2, 3, 4);
> sub foo (\@) { print join '+', @_ }
> foo (@a);
> __END__
> ARRAY(0xce3a4)
>
I don't know anything about prototyping
But, how goes up here:
#!/usr/local/bin/perl -w
@a = (1, 2, 3, 4);
&foo(@a);
foo(@a);
sub foo (\@) { print join('+', @_), "\n" }
&foo(@a);
foo(@a);
-------------------------
1+2+3+4
1+2+3+4
1+2+3+4
ARRAY(0x80df764)
Ronald
------------------------------
Date: Wed, 18 Aug 1999 12:58:41 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Connecting to UNC share via Perl/CGI
Message-Id: <7pealr$rfi$1@nnrp1.deja.com>
In article <7pe8h2$pqq$1@nnrp1.deja.com>,
sandman69@my-deja.com wrote:
> Yes that is definitely the case. But what permissions are needed on
the
> other server for a local IUSR account on a Web Server to Connect to
the
> share?
The Web Server needs to be logged in as a user with normal network
permissions, if it's running as a service it probably only has guest
access to the network.
This isn't the best NG to post to
for questions like this, try comp.infosystems.www.servers.ms-windows
HTH
Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 18 Aug 1999 14:10:50 +0100 (BST)
From: cszdp@cslin002.leeds.ac.uk (David Pashley)
Subject: Re: current dir in perl ?
Message-Id: <1999Aug18.131051.22476@leeds.ac.uk>
Tom Kralidis's words, in praise for the llamas, were:
> Try:
>
> #!/public/bin/perl -w
>
> use Cwd;
>
> $location = cwd();
>
> print "$location\n";
>
> ..Tom
>
I think you missed the point of the question.
> JduPayrat wrote:
> >
> > I have upgraded recently from perl (Active state) to 5.003_07 to 5.005_03
> > and have CGI problems. When I try to execute a CGI perl complains:
> > Can't locate module myModule.pl at @INC (c:\perl\lib, c:\perl\lib\site, .)
> >
> > I have to put:
> > use 'myDirectory';
> >
> > to have perl find the module (the module is in the same dir than the CGI). I
> > thougth perl couldn't find the current directory but when I put these
> > lines in my script, it reports the rigth path:
> >
> > open(LOG,'>myLog');
> > print LOG ,`cd` ; #I am on winNt
> > close LOG;
> >
> > any ideas ?
> >
> > ps: My web server is IIS 3.0 and I use perl ISAPI.
The problem you have is that perl only looks in directories in @INC for
modules. @INC doesn't normally contain the current working directory.
You need to add the directory containing the module to @INC. You can
either use unshift or the lib pragma.
For example to use c:\scripts\MyModule.pm
use lib qw/c:\scripts/;
use MyModule;
--
David Pashley
david@davidpashley.com
http://www.davidpashley.com
Now he understood - "If it ain't broken, don't fix it"
------------------------------
Date: Wed, 18 Aug 1999 16:09:27 +0100
From: "JduPayrat" <jdupayrat@webraska.com>
Subject: Re: current dir in perl ?
Message-Id: <7peelc$g9h$1@minus.oleane.net>
Well I don't think, it is the problem for two reasons:
_Perl reports '.' in @INC when my script fails. Morover, my CGI works when
launched from the command line.
_My CGI can't open files if I don't give it the full path.
It really seems to come from a working directory problem (maybe a security
thing).
>The problem you have is that perl only looks in directories in @INC for
>modules. @INC doesn't normally contain the current working directory.
>You need to add the directory containing the module to @INC. You can
>either use unshift or the lib pragma.
>For example to use c:\scripts\MyModule.pm
>
>use lib qw/c:\scripts/;
>use MyModule;
>
>--
>David Pashley
>david@davidpashley.com
>http://www.davidpashley.com
>Now he understood - "If it ain't broken, don't fix it"
------------------------------
Date: Wed, 18 Aug 1999 07:04:42 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: current dir in perl ?
Message-Id: <MPG.12245d5936ff4bfd9896c0@nntp1.ba.best.com>
David Pashley (cszdp@cslin002.leeds.ac.uk) seems to say...
> The problem you have is that perl only looks in directories in @INC for
> modules. @INC doesn't normally contain the current working directory.
Is that true? I thought that was only true when run under -T
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Wed, 18 Aug 1999 14:20:05 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: current dir in perl ?
Message-Id: <37c1cf37.18177928@news>
On Wed, 18 Aug 1999 07:04:42 -0700, moseley@best.com (Bill Moseley)
wrote:
>David Pashley (cszdp@cslin002.leeds.ac.uk) seems to say...
>> The problem you have is that perl only looks in directories in @INC for
>> modules. @INC doesn't normally contain the current working directory.
>
>Is that true? I thought that was only true when run under -T
-T turns on tainting checks.
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: Wed, 18 Aug 1999 07:30:54 -0700
From: Michael Peppler <mpeppler@peppler.org>
Subject: Re: DBI: prepare, and execute with placeholders - fails.
Message-Id: <37BAC39E.34F0F240@peppler.org>
leroy@mpi.com wrote:
>
> hi !
> following the pod of DBI, my usage of prepare/bind_param/execute
> fails.
>
<snip>
>
> but this would not work!
> always it complains that the 'command is idle'.
I have a feeling that this is against a Sybase database...
Please post a full trace of the test script (ie start the script with
DBI->trace(3);
as that will probably show us what is wrong.
Note: if this is DBD::Sybase and you are not yet using version 0.19 then please
upgrade first.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@peppler.org -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: Wed, 18 Aug 1999 14:38:25 +0300
From: Eli Zaretskii <eliz@is.elta.co.il>
Subject: Re: djgpp, Win98, Perl, and serial port
Message-Id: <Pine.SUN.3.91.990818143351.10490G-100000@is>
On Mon, 16 Aug 1999, David Christensen wrote:
> I'm not sure who Eli is. There are at least three sets of "serial
> libraries" for DJGPP.
These add-on libraries are only needed if Perl package(s) that use
serial communications require functionality that the DOS COM1 driver
doesn't supply (e.g., if they call ioctl etc.). Otherwise, simply
treating COM1 as if it were a file is enough.
> If someone were compiling a DJGPP Perl, it would make sense to try
> to compile in the Win32::API module.
No, Windows won't allow DOS programs issue Win32 API calls, so this is
a dead end.
> I haven't tried compiling Perl on
> Win95 (recently - it used to be "impossible"- I'm not sure about
> the current status).
It is possible to compile the DJGPP version of Perl on Windows 95 for at
least a year. I did that myself when I worked on the FSF CD-ROM.
------------------------------
Date: 18 Aug 1999 13:47:42 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: djgpp, Win98, Perl, and serial port
Message-Id: <19990818094742.13893.00000442@ng-cq1.aol.com>
Hi Eli:
>>"serial libraries" for DJGPP.
>
>These add-on libraries are only needed if Perl package(s) that use
>serial communications require functionality that the DOS COM1 driver
>doesn't supply (e.g., if they call ioctl etc.). Otherwise, simply
>treating COM1 as if it were a file is enough.
Based on the experiences of myself and numerous others, that
is only true for "vanilla" output (to a write-only printer or equivalent)
on Win9x. With parameters dictated by the options in MS-DOS
"MODE" command. The DOS driver for COM1 is worthless for
inputting to Perl - that is what started the demand for a module
solution that resulted in Win32::SerialPort.
>> If someone were compiling a DJGPP Perl, it would make sense to try
>> to compile in the Win32::API module.
>
>No, Windows won't allow DOS programs issue Win32 API calls, so this is
>a dead end.
Which seems to rule out an XS->Win32_API_calls solution as well.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Wed, 18 Aug 1999 10:18:01 -0400
From: Bob Freedman <bob.freedman@eis.noaa.gov>
Subject: Forking???
Message-Id: <37BAC099.F494B394@eis.noaa.gov>
I am trying to launch several instances of a perl program (test.pl)
while my parent process continues processing. Below is the parent
process but I am having trouble launching the child process.
foreach (@URL) {
$summaryFile = "$i\.summary";
$run = "/usr/local/bin/perl /cgi-bin/test.pl";
open(SUMMARIES,"$run $_ $var $summaryFile");
}
Any help is greatly appreciated.
------------------------------
Date: Wed, 18 Aug 1999 14:54:53 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Forking???
Message-Id: <1Pzu3.165$u07.1227@news.colt.net>
Bob Freedman <bob.freedman@eis.noaa.gov> wrote:
> I am trying to launch several instances of a perl program (test.pl)
> while my parent process continues processing. Below is the parent
> process but I am having trouble launching the child process.
Well, it sounds like fork() is what you need here...
> foreach (@URL) {
> $summaryFile = "$i\.summary";
> $run = "/usr/local/bin/perl /cgi-bin/test.pl";
> open(SUMMARIES,"$run $_ $var $summaryFile");
> }
Noooo! Thou shalt not use open() without checking the result! You mean:
open(SUMMARIES,"$run $_ $var $summaryFile") or die "Problem with open: $!";
In any case, this will not do what you want. You are using the same filehandle
each time through the loop, and not doing aything with it, so at the end
of your foreach loop you will have one open filehandle called SUMMARIES that
contains the output of the last time the command was run.
Furthermore, your parent process will wait for the open() to complete each time
so you are not really getting any benefit.
You probably want to look at fork() to spawn child copies of your program that
do the processing, but this is not trivial - you will need to read up on
fork() in Perl, and you will also need to understand processes in unix
generally. All the documentation for fork() that I'm aware of assumes that
you are familiar with notions such as PIDs and signals and assorted unix
stuff.
> Any help is greatly appreciated.
------------------------------
Date: 18 Aug 1999 10:59:31 -0400
From: Mark Mielke <markm@nortelnetworks.com>
Subject: Re: Forking???
Message-Id: <lq17lmt3zjg.fsf@bmers31f.ca.nortel.com>
Bob Freedman <bob.freedman@eis.noaa.gov> writes:
> I am trying to launch several instances of a perl program (test.pl)
> while my parent process continues processing. Below is the parent
> process but I am having trouble launching the child process.
> foreach (@URL) {
> $summaryFile = "$i\.summary";
^^ ???
> $run = "/usr/local/bin/perl /cgi-bin/test.pl";
> open(SUMMARIES,"$run $_ $var $summaryFile");
^^^^ ???
> }
> Any help is greatly appreciated.
Except for the two items I mark with '???' above, I believe you want
something like this:
my @child_pids;
my $url;
foreach $url (@URL) {
my $pid = fork;
defined($pid) || do {
# Let the currently running children finish...
waitForChildren(@child_pids);
defined($pid = fork) ||
die "$0: fork failed: $!\n";
};
# Child process gets $pid == 0...
if ($pid == 0) {
my $summaryFile = $url . ".summary";
exec "/usr/local/bin/perl", "/cgi-bin/test.pl", $url, $summaryFile;
die "$0: execl failed for $url: $!\n";
}
# Parent continues here...
push(@child_pids, $pid);
}
waitForChildren(@child_pids);
exit 0;
sub waitForChildren {
my $pid;
foreach $pid (@_) {
waitpid($pid, 0);
}
}
If you want to do fancier things, like catch the error code of the children
as they die and show which ones failed with a non-zero error code, I'll leave
it to you to research this more on your own...
mark
--
markm@nortelnetworks.com/mark@mielke.cc/markm@ncf.ca __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | CUE Development (4Y21)
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Nortel Networks
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada
One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...
http://mark.mielke.cc/
------------------------------
Date: 18 Aug 1999 13:44:01 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <7pedb1$s7c@fidoii.cc.Lehigh.EDU>
In comp.lang.perl.tk greg@apple2.com wrote:
> In article <7pckh9$6dj$1@news.NERO.NET>,
> stanley@skyking.OCE.ORST.EDU (John Stanley) wrote:
>>Dave Salovesh <darsal@erols.com> wrote:
Would all you folks kindly remove comp.lang.perl.tk from followups, we've
got work to do here.
Thanks,
------------------------------
Date: Wed, 18 Aug 1999 06:42:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: RE: Joining Two Integers
Message-Id: <MPG.1224582e5923d466989e6b@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article
<11020643E71FD311ACAA0008C7C563F3AF231A@gblon1c3ex1.wcom.co.uk> on Wed,
18 Aug 1999 12:59:18 +0100, Mujakporue, Trey <tmujak@wcom.co.uk> says...
+
+ I have the following problem.
+
+ [me] No shit you have a problem! don't we all!.
Without regard to the content of your response (for who can separate it
from the quoted material?), you are evidently not aware that there are
standard quoting conventions on Usenet. You are doing the opposite,
which will confuse many newsreading tools as well as some humans.
The headers show that you are not using any newsreader, and the
references are absent also. Please find and use a proper newsreader in
the future.
...
+ Any help would be appreciated!
+ [me] hope this is ok!
+
+ Sent via Deja.com http://www.deja.com/
+ Share what you know. Learn what you don't.
+
+
+
+ _____________________________________________________________
+ Deja.com: Share what you know. Learn what you don't.
+ http://www.deja.com/
+ * To modify or remove your subscription, go to
+ http://www.deja.com/edit_sub.xp?group=comp.lang.perl.misc
+ * Read this thread at
+ http://www.deja.com/thread/%3C7pe2bs%24lo0%241%40nnrp1.deja.com%3E
+
+ ----------------------
+ CONFIDENTIALITY NOTICE
+ This communication contains information which is confidential and may
also be
+ privileged. It is for the exclusive use of the intended recipient(s).
If you
+ are not the intended recipient(s), please note that any distribution,
copying
+ or use of this communication or the information in it is strictly
prohibited.
+ If you have received this communication in error, please notify us
immediately
+ by telephone on +44 171 675 5000 and then destroy the email and any
copies of
+ it. This communication is from MCI WorldCom Limited whose registered
office is
+ at 14 Gray's Inn Road, London WC1X 8HN. Registered number 2776038.
+
+
+
+ Sent via Deja.com http://www.deja.com/
+ Share what you know. Learn what you don't.
All the rest of this is absurd noise, including *three* copies of the
stupid Deja.com mantra and a confidentiality notice (for a post that has
reached thousands of readers!). Please don't send such silly stuff
again. And don't post again before reading the newsgroup
'news.announce.newusers'.
By the way, my response is overquoted, and also shows what happens when
quoted lines are too long. Yuk!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 18 Aug 1999 13:03:09 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: launching applications
Message-Id: <7peb3n$kur$2@news.mch.sbs.de>
In article <37BA2341.F516A63F@anlon.com>, Mike <kangas@anlon.com> wrote:
[snip]
>2) Run an application on the clients machine from the browser.
> example: A client wants to send a text file so you want to open notepad on
>their machine...
> Impossible to do with system calls `notepad ClientData.txt`. THIS WILL NOT
>WORK.
Well, what you could do is build an ActiveX component with a method like
'open file', put that ActiveX as an object in your HTML page, and call the
method with JavaScript. Of course, your users will need to use IE as browser,
and they will have to relax their security settings to allow unsigned and
unsafe-for-scripting components to run... NOT RECOMMENDED !
Cheers,
Michel.
------------------------------
Date: Wed, 18 Aug 1999 13:49:18 GMT
From: "Darren Janisse" <djanisse@northrock.bm>
Subject: Numeric Formatting
Message-Id: <yRyu3.2886$1B5.178885@monger.newsread.com>
Hello,
Would someone be able to provide info on how to do the following:
Input Day #: 3 (as example)
... the output would still be 3. Is there any way to format this string to
have a static placement of two spaces (for example, the above would output
03 instead of 3). Any suggestions would be greatly appreciated.
Thanks,
Darren
------------------------------
Date: Wed, 18 Aug 1999 14:09:30 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Numeric Formatting
Message-Id: <u8zu3.161$u07.1316@news.colt.net>
Darren Janisse <djanisse@northrock.bm> wrote:
> Hello,
> Would someone be able to provide info on how to do the following:
> Input Day #: 3 (as example)
> ... the output would still be 3. Is there any way to format this string to
> have a static placement of two spaces (for example, the above would output
> 03 instead of 3). Any suggestions would be greatly appreciated.
Look at the perl function sprintf:
http://www.perl.com/pub/doc/manual/html/pod/perlfunc/sprintf.html
------------------------------
Date: Wed, 18 Aug 1999 14:09:43 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Numeric Formatting
Message-Id: <37bcccbc.17542965@news>
On Wed, 18 Aug 1999 13:49:18 GMT, "Darren Janisse"
<djanisse@northrock.bm> wrote:
>Would someone be able to provide info on how to do the following:
>
>Input Day #: 3 (as example)
>
>... the output would still be 3. Is there any way to format this string to
>have a static placement of two spaces (for example, the above would output
>03 instead of 3). Any suggestions would be greatly appreciated.
perldoc -f printf
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: 18 Aug 1999 14:06:02 GMT
From: strong@cis.ohio-state.edu (michael j strong)
Subject: passing file handles to a sub
Message-Id: <7peeka$3c2$1@news.cis.ohio-state.edu>
Hello,
I am trying to pass a file handle to a sub. I am declaring the sub as
follows:
sub Process(\*file)
{
.........
now how do I use it in the sub's code block? And in the main part how do
I call it? Do I just pass the file handle or put it in quotes?
Any help is appreciated.
MIke
------------------------------
Date: 18 Aug 1999 10:27:58 -0400
From: Matt Curtin <cmcurtin@interhack.net>
Subject: Re: passing file handles to a sub
Message-Id: <xlx1zd1w4cx.fsf@gold.cis.ohio-state.edu>
>>>>> On 18 Aug 1999 14:06:02 GMT,
strong@cis.ohio-state.edu (michael j strong) said:
Hi Mike,
michael> I am trying to pass a file handle to a sub. I am declaring
michael> the sub as follows:
michael> sub Process(\*file)
michael> {
Your declaration is incorrect. What you really want is this:
sub routine {
my $FH = shift;
}
(The prototype would be `sub routine (*)', but I wouldn't bother,
frankly, because Perl's "prototypes" aren't really what you might
think they are. At present, they're basically just templates for
calling your functions so that you don't need to put parentheses
around your arguments.)
Then in order to use the routine, you'd call it thusly:
open(FH, "< /tmp/foo") or die "cannot open /tmp/foo: $!";
routine(*FH);
Here's an example program I called /tmp/foo.pl:
----------------------------------------------------------------------
#!/usr/local/bin/perl -w
use strict;
open(FH, "</tmp/foo.pl") or die "cannot open /tmp/foo.pl: $!";
routine(*FH);
print "\nall done\n";
sub routine {
my $FH = shift;
while(<FH>) {
print;
}
}
----------------------------------------------------------------------
You'll find useful information in the `perlglob', `perlref', and
`perlsub' man pages.
--
Matt Curtin cmcurtin@interhack.net http://www.interhack.net/people/cmcurtin/
------------------------------
Date: Wed, 18 Aug 1999 14:34:44 GMT
From: thomasyeung@my-deja.com
Subject: Re: Pattern matching on command line
Message-Id: <7pega4$vuk$1@nnrp1.deja.com>
In article <x3y3dxie0g2.fsf@tigre.matrox.com>,
Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
> tyeung@netscape.net writes:
>
> > I am new to Perl so can you tell me exactly where perldoc and
perldata
> > is? or do u mean the manpage for perldoc?
>
> 'perldoc' is a little program that comes with every complete Perl
> distribution. To familiarize yourself with it, type 'perldoc perldoc'
> at the command prompt. If you get an error message saying "Command not
> found" or something of this sort, then your Perl installation was
> not complete. Re-install Perl.
>
> I suggest you then read 'perltoc' by typing 'perldoc perltoc' at the
> command prompt. This will list all the documentation available on your
> system. If any of them is missing, then your Perl installation was not
> complete. Re-install Perl.
>
> > I am trying to throw the "m/word/i" into the if condition
> > so the $string will do a pattern matching with it..
> > in the command line I can change the modifier if I want it to
> > like "s/^word\b/g" something like that..
>
> Ok. Good. What is your question?
>
The question is how do I do it so the it will pick up the pattern
matching modifier like s,e,g,i,\b on the command line.
> Ala
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 18 Aug 1999 08:35:39 -0400
From: kent@darwin.eeb.uconn.edu
Subject: Re: Perl HTML to txt
Message-Id: <wku2pxw9k4.fsf@darwin.eeb.uconn.edu>
A quick check of CPAN would reveal the existence of
HTML::FormatText
HTML::Parse
with which all you need to do is
#!/usr/bin/perl -w
use HTML::FormatText;
use HTML::Parse;
$html = parse_htmlfile ("Your HTML file here");
$formatter = new HTML::FortmatText;
print $formatter->format($html);
Kent
--
Kent E. Holsinger Kent@Darwin.EEB.UConn.Edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-43
-- Storrs, CT 06269-3043
------------------------------
Date: Wed, 18 Aug 1999 09:42:38 -0400
From: Patrick Tully <pmt@top.mitre.org>
Subject: Problems with Permissions, need some insight
Message-Id: <37BAB84E.7642FD94@top.mitre.org>
Hi,
Let me just state my questions first in case you don't want to read the
entire mesg:
1. How do I create a directory and make it write/read everyone?
[mkdir ("directoryName", 0777); does not work]
2. Can I change ownership in the program, and if so how?
The details:
I created a login program that creates user directories and puts a few
default files inside the directories. I set the root directory to be
777 using my ftp program. I used the perl function:
mkdir ("$directory$UserName", 0777); where directory is the root
directory and username is the name of the user's new directory we are
creating. I want to set the permissions so that the user directory is
writable by everyone, 777, right? Now there must be something wrong
with this syntax because when i run the scritpt, the user directories
become - 755 (or drwxr-xr-x). Also when i great the files (which are
created 777 as well) i can't write to them from another script. It
gives me a permission error (could this be because of the directory
permissions?). One other thing is that, when i log using ftp, i can't
delete any files or folders i created using the script. The only way to
delete this files is to run a script to delete them (my guess is that
the owner for the directories/files is 'nobody'?). Thanks for any help,
-Patrick Tully-
tcblue82@yahoo.com
------------------------------
Date: 18 Aug 1999 13:57:17 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Spell Checker
Message-Id: <19990818095717.13893.00000443@ng-cq1.aol.com>
Hi:
>I need to spell check a text box control on a form. Is there a PERL
>solution avaliable that I can run on the Unix server?
There was a thread about two weeks ago about translating from
Czech <-> English that used something very like a spell checker
to decide which words already had translations. It was actually
built up from a dictionary lookup. The original script used the
linux word list - so it, at least, ran on un*x. I'm not sure about
the later versions.
I have copies if you can't find the postings.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Wed, 18 Aug 1999 14:14:51 +0100
From: Simon Wistow <simon@profero.com>
Subject: splitting on unquoted commas
Message-Id: <37BAB1CB.73C06426@profero.com>
I'm trying to split up people int the From: line of an email. Easy, I thought,
split on commas. But then I realised that this
john@foo.com "Smith, John", bob@bar.com "Bob Roberts"
whilst legitimate, would produce
john@foo.com "Smith
John"
bob@bar.com "Bob Roberts"
the best way I came up with is something like
$line = 'john@foo.com "Smith, John", bob@bar.com "Bob Roberts"';
foreach (split(/,/,$line))
{
push @people, $_ if (/\@/);
$people[$#people].= ",$_" if (!/\@/);
}
which produces
john@foo.com "Smith, John"
bob@bar.com "Bob Roberts"
but then this would fail if someone had
matt@foo.com "Smith, M@tt"
and extreme case yes but I want to cover all the bases.
Am I going to have to loop though, working out whether or not I'm in a quote or
is there a better way of doing it.
Could Text::ParseWords help?
Cheers
Simon
--
Simon Wistow Development
simon@profero.com Profero Ltd
Phone : 0171 700 9960 Fax : 0171 700 9961
------------------------------
Date: Wed, 18 Aug 1999 13:37:54 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
To: Simon Wistow <simon@profero.com>
Subject: Re: splitting on unquoted commas
Message-Id: <sizozpxl8t.fsf@cre.canon.co.uk>
Simon Wistow <simon@profero.com> wrote:
> I'm trying to split up people in the From: line of an email.
Graham Barr's Mail::Address module provides a `parse' method for doing
exactly this.
Mail::Address is in the MailTools distribution, available from
http://www.cpan.org/modules/by-module/Mail/MailTools-1.13.tar.gz
If you want to parse the From header yourself, you'll need to know the
full specification - otherwise you'll get it wrong. See RFC 822 for the
gory details: ftp://src.doc.ic.ac.uk/rfc/rfc822.txt
--
Gareth Rees
------------------------------
Date: Wed, 18 Aug 1999 09:58:04 -0400
From: "Casey R. Tweten" <crt@kiski.net>
Subject: Re: splitting on unquoted commas
Message-Id: <Pine.OSF.4.10.9908180953570.5753-100000@home.kiski.net>
On Wed, 18 Aug 1999, Simon Wistow wrote:
:I'm trying to split up people int the From: line of an email. Easy, I thought,
:split on commas. But then I realised that this
: john@foo.com "Smith, John", bob@bar.com "Bob Roberts"
:whilst legitimate, would produce
:
: john@foo.com "Smith
: John"
: bob@bar.com "Bob Roberts"
:
:the best way I came up with is something like
[snip some code, and explenation]
:Am I going to have to loop though, working out whether or not I'm in a quote or
:is there a better way of doing it.
Why not reformat the names first, and then split them up:
#!/usr/local/bin/perl -w
use strict;
my $from = q/john@foo.com "Smith, John", bob@bar.com "Bob Roberts"/;
$from =~ s/"(\w+)[,| ]+(\w+)"/"$2 $1"/g;
# Reformats "Smith, John" to be "John Smith"
my @senders = split /,/, $from;
foreach (@senders) {
print "$_ \n",
}
this will split them up the way you want.
have fun!
--
Casey R. Tweten <joke> This
Web Developer is 100% certified
HighVision Associates virus and bug
crt@highvision.com free code. </joke>
------------------------------
Date: Wed, 18 Aug 1999 14:47:43 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: Strange Error
Message-Id: <37BAC77C.F5FF2B3F@blackhole-designs.com>
--------------8F0DB108B9977CB966D99959
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
I'm getting the following error in my perl/cgi script in my log files.
[Wed Aug 18 09:34:23 1999] [error] [client 24.93.92.238] Premature end
of script
headers: /home/sailing/public_html/cgi-bin/signup.pl
Could anybody tell me why this might be happening. You can view my code
at http://www.sailingpoint.com/signup.txt
I'm using perl 5.005_02 on SunOS 5.7. And, everything with my html form
is correct btw.
Jimmy
--------------8F0DB108B9977CB966D99959
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>I'm getting the following error in my perl/cgi script in my log files.
<p>[Wed Aug 18 09:34:23 1999] [error] [client 24.93.92.238] Premature end
of script
<br> headers: /home/sailing/public_html/cgi-bin/signup.pl
<p>Could anybody tell me why this might be happening. You can view
my code at <A HREF="http://www.sailingpoint.com/signup.txt">http://www.sailingpoint.com/signup.txt</A>
<p>I'm using perl 5.005_02 on SunOS 5.7. And, everything with my
html form is correct btw.
<br>
<p>Jimmy
<br>
<br><tt></tt> </html>
--------------8F0DB108B9977CB966D99959--
------------------------------
Date: Wed, 18 Aug 1999 15:03:57 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Strange Error
Message-Id: <xXzu3.166$u07.1227@news.colt.net>
Jimmy Humphrey <jimmy@blackhole-designs.com> wrote:
> --------------8F0DB108B9977CB966D99959
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
First off, you are posting this message in both ASCII (good) and HTML (bad).
If you are using Netscape to post message make VERY SURE that you turn this
feature off, before you annoy everyone on the whole internet. REally, I mean
it.
> Hi,
> I'm getting the following error in my perl/cgi script in my log files.
> [Wed Aug 18 09:34:23 1999] [error] [client 24.93.92.238] Premature end
> of script
> headers: /home/sailing/public_html/cgi-bin/signup.pl
It's one of those 'accurate but useless' error messages beloved of almost
every bit of software in existance, although fortunately not Perl. That is
the first indication that Perl is not the problem here.
The CGI protocol (which you are using) requires that the first output from
you CGI program is a header that describes the rest of the output. In this
header there must be at least one line (often it is the only line) that
describes the type of content that you are outputing. This is normally html.
So, you program needs to output the string 'Content-type: text/html' followed
by two linebreaks (to show the header has ended, and the real content will
follow).
If you script omits this altogether, you have no idea what CGI is and should
read up on it at once. If you think your script omits this header, make sure
that your script does not give any warnings or other output when it runs.
> I'm using perl 5.005_02 on SunOS 5.7. And, everything with my html form
> is correct btw.
The html form is the least of your problems.
FYI, this post concerns CGI not perl. Please read all the documentation on CGI
that you can find.
------------------------------
Date: Wed, 18 Aug 1999 09:25:41 -0400
From: "Casey R. Tweten" <crt@kiski.net>
Subject: Re: Tab range extension
Message-Id: <Pine.OSF.4.10.9908180924130.9680-100000@home.kiski.net>
On Wed, 18 Aug 1999, Aydin Ucar wrote:
:Does anyone know how to manage tab extension, I tried to
:extend tab character long as use double
:\t\t; but didn't work. It jumped at when it is reached to fix 8
:digits long as default...Wheras I want to use Tab as 12 character
:long...
Use a format, you can make your tab be as long as you want.
perldoc -f format
have fun!
--
Casey R. Tweten <joke> This
Web Developer is 100% certified
HighVision Associates virus and bug
crt@highvision.com free code. </joke>
------------------------------
Date: Wed, 18 Aug 1999 14:29:56 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Tab range extension
Message-Id: <37babd30.20568261@news.hydro.co.uk>
A keyboard was whacked upside Aydin Ucar's head and out came:
>Does anyone know how to manage tab extension, I tried to
>extend tab character long as use double
>\t\t; but didn't work. It jumped at when it is reached to fix 8
>digits long as default...Wheras I want to use Tab as 12 character
>long...
At your shell prompt type 'tabs -12'.
Gary
--
Gary O'Keefe
gary@onegoodidea.com
You know the score - my current employer has nothing to do with what I post
------------------------------
Date: Wed, 18 Aug 1999 06:20:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: what does eq do on lists?
Message-Id: <MPG.122452e12efc7db0989e6a@nntp.hpl.hp.com>
In article <37BA7FBE.D5F2BC@gmx.net> on Wed, 18 Aug 1999 11:41:18 +0200,
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> says...
> Sam Holden wrote:
> >
> > Or you could use join() to create the strings to compare, but
> > then you have the problem of what to use as the first argument to
> > join, so you don't get any collisions.
>
> $; might be a value to start with, since \034 is unlikely to occur in
> data.
Or "\0". Especially if the data are ever seen as strings by a C
program.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 573
*************************************