[16054] in Perl-Users-Digest
Perl-Users Digest, Issue: 3466 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 23 18:05:50 2000
Date: Fri, 23 Jun 2000 15:05:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961797923-v9-i3466@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 23 Jun 2000 Volume: 9 Number: 3466
Today's topics:
$$variable_name help (Daniel Koehne)
Re: $$variable_name help (Greg Bacon)
Re: $$variable_name help <rootbeer@redcat.com>
Re: $$variable_name help <tina@streetmail.com>
Re: $$variable_name help <care227@attglobal.net>
Re: [ Regexp ] Curious Behaviour of " last if /(match)/ <TheEx0rcist@fanclub.org>
Re: [ Regexp ] Curious Behaviour of " last if /(match)/ (Tad McClellan)
AIX Dynamic loading error: bad RLD 0; swig-c++ problem? <william.dowling@isinet.com>
Re: Any Perl experts around? farahas@my-deja.com
Re: Any Perl experts around? <russ_jones@rac.ray.com>
Re: BIG BUG in CGI.pm on Internet Explorer !! (Bart Lateur)
browser doesn't display images <T.Veit@psi-bt.de>
Re: browser doesn't display images <dwilgaREMOVE@mtholyoke.edu>
Re: browser doesn't display images <ewald@electronicfrontiers.com>
Can't Use OLE bayers@my-deja.com
Re: Can't Use OLE bayers@my-deja.com
Re: Can't Use OLE <rootbeer@redcat.com>
Re: checking that a process is not running <westxga@my-deja.com>
Re: Crazy enough that it might just work... (David H. Adler)
Re: Dereferencing a two dimensional array? <aperrin@davis.DEMOG.Berkeley.EDU>
Re: Determining Dates nobull@mail.com
Re: Dir Listsing <psychoNOpsSPAM@pcpatches.com.invalid>
Forcing unbuffered stdout from command line? <db3l@fitlinxx.com>
Re: Getting current working directory in perl script (Clinton A. Pierce)
Re: Hash keys (Bart Lateur)
Help - Brain Teaser <dpeter@freenetname.co.uk>
Help with s/ //g and s// /g abliss@mindspring.com
Re: Help with s/ //g and s// /g <tina@streetmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 23 Jun 2000 19:25:18 GMT
From: dfkoehne@nads-sc.uiowa.edu (Daniel Koehne)
Subject: $$variable_name help
Message-Id: <3953b8ba.856778203@news.uiowa.edu>
If I have the following variables:
my $aa = 10;
my $bb = 'aa';
In this case the variable bb contains the variable aa name.
I would expect $$bb to print 10. Instead it appears to be printing
nothing.
I must be doing something wrong and am wondering if anyone can help me
out.
Thanks in advance
Daniel
=================================================
Daniel Koehne ph: (319) 335 4797
NADS-SC System Administrator fax: (319) 335 4658
University of Iowa
=================================================
------------------------------
Date: Fri, 23 Jun 2000 19:46:02 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: $$variable_name help
Message-Id: <sl7fjq7e7f95@corp.supernews.com>
In article <3953b8ba.856778203@news.uiowa.edu>,
Daniel Koehne <dfkoehne@nads-sc.uiowa.edu> wrote:
: If I have the following variables:
: my $aa = 10;
: my $bb = 'aa';
:
: In this case the variable bb contains the variable aa name.
See "Why it's stupid to `use a variable as a variable name'"[*].
[*] <URL:http://www.plover.com/~mjd/perl/varvarname.html>
Greg
--
Carrying the idea further (reductio ad absurdum? :-) C<local $$;>
would be identical to fork()...
-- Jarkko Hietaniemi
------------------------------
Date: Fri, 23 Jun 2000 12:51:27 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: $$variable_name help
Message-Id: <Pine.GSO.4.10.10006231249310.23149-100000@user2.teleport.com>
On Fri, 23 Jun 2000, Daniel Koehne wrote:
> I would expect $$bb to print 10. Instead it appears to be printing
> nothing.
Lexical ("my") variables aren't in the symbol table, so soft references
can't find them. This is a feature, not a bug!
It sounds as if you want to use the contents of a variable as a
variable name. See this.
http://www.plover.com/~mjd/perl/varvarname.html
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 23 Jun 2000 19:52:37 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: $$variable_name help
Message-Id: <8j0f65$5jsum$8@fu-berlin.de>
hi,
Daniel Koehne <dfkoehne@nads-sc.uiowa.edu> wrote:
> If I have the following variables:
> my $aa = 10;
> my $bb = 'aa';
> In this case the variable bb contains the variable aa name.
> I would expect $$bb to print 10. Instead it appears to be printing
> nothing.
this was already discussed here. you are
using a symbolic reference.
by the way, you should better write ${$bb} than $$bb.
${$bb} is looking for a global variable "$aa" which
does not exist.
try:
use vars '$bb';
$aa = 10;
my $bb = 'aa';
print ${$bb};
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."
------------------------------
Date: Fri, 23 Jun 2000 15:59:00 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: $$variable_name help
Message-Id: <3953C184.7792C5BF@attglobal.net>
Daniel Koehne wrote:
>
> If I have the following variables:
> my $aa = 10;
> my $bb = 'aa';
>
> In this case the variable bb contains the variable aa name.
No, it contains the literal text aa. If you want it to contain
a reference to $aa, you need to tell it so. Such as:
my $bb = \$aa;
Now $$bb will print 10. If you don't want to contain a reference
to the variable $aa, you simply assign $aa to $bb, but you probably
already knew that one.
> I would expect $$bb to print 10. Instead it appears to be printing
> nothing.
Why do you expect that to be the case? You'll want to read:
$ perldoc perlref
$ perldoc perlreftut
------------------------------
Date: Mon, 19 Jun 2000 20:05:18 GMT
From: "TheEx0rcist" <TheEx0rcist@fanclub.org>
Subject: Re: [ Regexp ] Curious Behaviour of " last if /(match)/ "
Message-Id: <8ILUET$2N5G$1@NEWS4.ISDNET.NET>
> Neither example does anything useful because the
> filehandle is FILE, not SDJ.
Sorry stupid typo (bad copy / paste)
please replace <SDJ> by <FILE>
Thanks :-)
------------------------------
Date: Mon, 19 Jun 2000 21:28:41 GMT
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: [ Regexp ] Curious Behaviour of " last if /(match)/ "
Message-Id: <SLRN8KT449.DUE.TADMC@MAGNA.METRONET.COM>
On Mon, 19 Jun 2000 21:26:12 +0200, TheEx0rcist <TheEx0rcist@fanclub.org> wrote:
>I am trying to retrieve the first occurence of "match" in the file $file :
>
>--
>open (FILE,"$file") or die "$file : $!";
^ ^
Those quotes don't do anything, and therefore, should not be there.
> while (<SDJ>) {
> last if /(match)/;
> };
>print $1;
>--
>
>However I don't know why
Because that is what it is supposed to do.
>but as soon as the loop is exited, the matched
>pattern : $1 becomes empty (!)
>Can anyone
The docs that you got with your perl can.
They should already be on your hard disk.
>explain why in the first case, $1 comes empty?
'perlre.pod' describes Perl's regular expressions.
If you are having trouble with regex memories, then you should
go read about regex memories:
perldoc perlre
-------- 5.6 -----------------------
The numbered variables ($1, $2, $3, etc.) and the related punctuation
set (C<<$+>, C<$&>, C<$`>, and C<$'>) are all dynamically scoped
until the end of the enclosing block or until the next successful
match, whichever comes first.
--------------------------------------
-------- 5.005_03 -----------------------
The scope of $E<lt>digitE<gt> (and C<$`>, C<$&>, and C<$'>)
extends to the end of the enclosing BLOCK or eval string, or to the next
successful pattern match, whichever comes first.
-------------------------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Jun 2000 18:08:45 GMT
From: "William F. Dowling" <william.dowling@isinet.com>
Subject: AIX Dynamic loading error: bad RLD 0; swig-c++ problem?
Message-Id: <3953A7AA.7CE0551@isinet.com>
Can someone help me understand the 'bad RLD 0' error I am getting?
I get this message when doing dynamic loading (from the perl DynaLoader
module):
Can't load 'bin.aix4/Example.so' for module Example: dlopen:
bin.aix4/Example.so: bad RLD 0 bin.aix4/Example.so at
/links/extern/perl5005.cc.aix4/lib/5.00503/aix/DynaLoader.pm line 169.
The build of bin.aix4/Example.so appeared to be clean -- no errors or
warnings from
ld -bnoentry -bernotok -bE:Example.exp -bE:extra.exp -G
-bloadmap:LoadMap \
-lperl -L/links/extern/perl5005.cc.aix4/lib/5.00503/aix/CORE
-lbsd -lC \
-obin.aix4/Example.so bin.aix4/Example.o bin.aix4/Example_wrap.o
Example.o has the definition of a trivial class; Example_wrap.o was
built from a SWIG-generated wrapper; both compiled without
errors/warnings.
Environment: AIX 4.2.1; perl 5.005.03 (fresh clean build, passed all
build tests), xlC C++ compiler, SWIG Version 1.1 (Build 883)
Any leads at all are greatly appreciated!
Thanks,
Will
--
William F. Dowling
Institute for Scientific Information
215-386-0100 x-1156
------------------------------
Date: Fri, 23 Jun 2000 20:18:53 GMT
From: farahas@my-deja.com
Subject: Re: Any Perl experts around?
Message-Id: <8j0gmq$iab$1@nnrp1.deja.com>
Does everybody in NGs have a dry sence of humour as you guys.....or is
this the way people communicate on NGS??
Just curious!!!
Farah
In article <i1M35.410$My4.40073@news.dircon.co.uk>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Tue, 20 Jun 2000 14:38:16 +0200, Alan J. Flavell Wrote:
> > On Tue, 20 Jun 2000 farahas@my-deja.com up-ended usenet in
> > the newfangled way of things, and blurted out:
> >
> >> Obviously the word mannerism doesn't figure in your
> >> dictionary....
> >
> > bizarre
> >
>
> I think what you meant to say was the word mannerism does but
apparently
> its broken because the meaning it suggests would be inappropriate in
this
> context.
>
> >
> > Score duly adjusted.
> >
>
> Straight in with the -100 for me i'm afraid ... ;-}
>
> /J\
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 15:56:39 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Any Perl experts around?
Message-Id: <3953CF07.F4216D7D@rac.ray.com>
farahas@my-deja.com wrote:
>
> Does everybody in NGs have a dry sence of humour as you guys.....or is
> this the way people communicate on NGS??
> Just curious!!!
>
> Farah
>
I'm aching to know what your hair looks like.
--
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: Fri, 23 Jun 2000 20:41:26 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: BIG BUG in CGI.pm on Internet Explorer !!
Message-Id: <3953c082.603845@news.skynet.be>
Makau Divangamene wrote:
>The loss of parameters is a CRICTICAL
>problem for most cgi coders and a work around is better than nothing.
You're sure you don't accidently use a GET instead of a POST? Servers
usually put a severe limitation on how much data will be passed along
using GET. POST has far more relaxed limitations.
--
Bart.
------------------------------
Date: Fri, 23 Jun 2000 15:32:08 GMT
From: "Torsten Veit" <T.Veit@psi-bt.de>
Subject: browser doesn't display images
Message-Id: <8IVVQ4$LQE$1@WRATH.NEWS.NACAMAR.DE>
Hi,
in Perl I try to dynamically insert jpg-images into html. But the browser
shows everything but the images. In the browser if I check the properties of
the images, the path and the name is correct.
perl-statements:
$imgm="image1.jpg";
...
print "<img src=\"",$imgm,"\" align=bottom width=64 height=64>\n";
What is wrong?
Any hints or suggestions?
Thanks, Torsten
------------------------------
Date: Fri, 23 Jun 2000 19:31:47 GMT
From: Dan Wilga <dwilgaREMOVE@mtholyoke.edu>
Subject: Re: browser doesn't display images
Message-Id: <dwilgaREMOVE-4578DD.15315023062000@news.mtholyoke.edu>
In article <8ivvq4$lqe$1@wrath.news.nacamar.de>, "Torsten Veit"
<T.Veit@psi-bt.de> wrote:
> Hi,
>
> in Perl I try to dynamically insert jpg-images into html. But the browser
> shows everything but the images. In the browser if I check the properties of
> the images, the path and the name is correct.
Another possibility is that your web server is not configured to display any
document that is in the same path as a CGI program. This is the default
condition for Apache ScriptAlias directories, for instance. It's one way to
help keep people from seeing the source of scripts that do not have the
execute bit set.
To test this, try accessing the URL of the image directly, i.e.:
http://yourserver.com/cgi-bin/image1.jpg (since, as you have it written, the
JPEG must be in the same folder as the CGI script.)
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Fri, 23 Jun 2000 16:15:02 -0400
From: "Edward Waldspurger" <ewald@electronicfrontiers.com>
Subject: Re: browser doesn't display images
Message-Id: <8j0glg$e9q$1@triox.mtcibs.com>
"Dan Wilga" <dwilgaREMOVE@mtholyoke.edu> wrote in message
news:dwilgaREMOVE-4578DD.15315023062000@news.mtholyoke.edu...
> In article <8ivvq4$lqe$1@wrath.news.nacamar.de>, "Torsten Veit"
> <T.Veit@psi-bt.de> wrote:
>
> > Hi,
> >
> > in Perl I try to dynamically insert jpg-images into html. But the
browser
> > shows everything but the images. In the browser if I check the
properties of
> > the images, the path and the name is correct.
>
> Another possibility is that your web server is not configured to display
any
> document that is in the same path as a CGI program. This is the default
> condition for Apache ScriptAlias directories, for instance. It's one way
to
> help keep people from seeing the source of scripts that do not have the
> execute bit set.
>
> To test this, try accessing the URL of the image directly, i.e.:
> http://yourserver.com/cgi-bin/image1.jpg (since, as you have it written,
the
> JPEG must be in the same folder as the CGI script.)
>
> Dan Wilga dwilgaREMOVE@mtholyoke.edu
> ** Remove the REMOVE in my address address to reply reply **
If the image is not in the cgi-bin directory, try using an absolute path to
the image. (ex: img src="/image1.jpg").
-Ed Waldspurger
------------------------------
Date: Fri, 23 Jun 2000 15:18:33 GMT
From: bayers@my-deja.com
Subject: Can't Use OLE
Message-Id: <8IVV3N$46A$1@NNRP1.DEJA.COM>
This bit of cgi code crashes. It's in a plx file:
use Win32::OLE;
print "Content-type: text/html\n\n";
print "i";
This runs fine:
#use Win32::OLE;
print "Content-type: text/html\n\n";
print "i";
As does this:
use strict;
print "Content-type: text/html\n\n";
print "i";
When run from the command line, this code, in a pl file, works fine:
use Win32::OLE;
$Conn = CreateObject Win32::OLE "ADODB.Connection";
$Conn->Open("DSN=MSSQL;UID=user;PWD=password");
$Conn->Open("SQL");
$RS = $Conn->Execute("SELECT * FROM TIMECLOK");
while ( !$RS->EOF ) {
my($Author, $Title) = (
$RS->Fields('ID')->value,
$RS->Fields('NAME')->value);
print $Author, " : ", $Title, "\n";
$RS->MoveNext;
}
$RS->Close;
$Conn->Close;
I'm using activestate perl version 5.22 on NT4 with IIS4. I originally
had 5.005 and tried upgrading to 5.6 but couldn't get the ppm hotfix to
work. I then installed 5.22. I'm at a loss for other things to try.
Thanks in advance.
- Jim
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 19:51:01 GMT
From: bayers@my-deja.com
Subject: Re: Can't Use OLE
Message-Id: <8j0f2t$h02$1@nnrp1.deja.com>
Hmmm
use CGI::Carp qw/ fatalsToBrowser /;
#use Win32::OLE;
print "Content-type: text/html\n\n";
print "i";
works, but:
use CGI::Carp qw/ fatalsToBrowser /;
use Win32::OLE;
print "Content-type: text/html\n\n";
print "i";
gives me the same message I've gotten since the problem started:
'W:\Inetpub\wwwroot\cgi-bin\test.plx' script produced no output
In article <Pine.GSO.4.10.10006231042540.10836-
100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Fri, 23 Jun 2000 bayers@my-deja.com wrote:
>
> > Newsgroups: comp.lang.perl.misc, comp.lang.perl.module
>
> Perhaps you meant "comp.lang.perl.modules" there.
>
> > This bit of cgi code crashes. It's in a plx file:
> >
> > use Win32::OLE;
> > print "Content-type: text/html\n\n";
> > print "i";
>
> Well, that's not HTML! But that's a quibble. Maybe you can make this
one
> work to tell you something. It won't produce valid HTML either. :-)
>
> use CGI::Carp qw/ fatalsToBrowser /;
> use Win32::OLE;
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 23 Jun 2000 13:28:02 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Can't Use OLE
Message-Id: <Pine.GSO.4.10.10006231327310.23149-100000@user2.teleport.com>
On Fri, 23 Jun 2000 bayers@my-deja.com wrote:
> gives me the same message I've gotten since the problem started:
>
> 'W:\Inetpub\wwwroot\cgi-bin\test.plx' script produced no output
When you're having trouble with a CGI program in Perl, here's a handy
troubleshooting guide to get you back on track.
http://www.smithrenaud.com/public/troubleshooting_CGI.html
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 23 Jun 2000 20:36:31 GMT
From: Glenn West <westxga@my-deja.com>
Subject: Re: checking that a process is not running
Message-Id: <8j0hoe$j5o$1@nnrp1.deja.com>
In article <39539470.1FBBF320@hitchcock.NOSPAM.org>,
Andrew Bacchi <andrew.g.bacchi@hitchcock.NOSPAM.org> wrote:
[snipped]
> Please review and make suggestions for improvement. Thanks in
advance.
>
> #!/usr/bin/perl -w
>
> # This script creates a new Apache Access log file and renames the old
> file with the date appended the the original name.
> # The script runs from crontab on the first day of the month.
>
> use strict;
>
> `/usr/local/apache/bin/apachectl stop`; # Stop the Apache web
> server.
> my $exist = `ps -A | grep httpd`; # Check that httpd is
not
> running.
And how do you know I don't have a process called my_httpd running?
> my ($DAY, $MONTH, $YEAR) = (localtime)[3,4,5]; #Scaler vars for
> appending the date stamp to the old log file.
You are aware that (localtime)[5] gives 100 not 00 aren't you? And
that (localtime)[4] goes from 0 through 11?
[rest of code snipped as it was addressed in a previous response]
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 20 Jun 2000 15:01:23 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Crazy enough that it might just work...
Message-Id: <SLRN8KSLST.I5I.DHA@PANIX6.PANIX.COM>
On Mon, 19 Jun 2000 04:52:18 +0930, Henry <henry@penninkilampi.net> wrote:
>In article <slrn8kq7a3.4ba.dha@panix6.panix.com>, dha@panix.com (David
>H. Adler) wrote:
>> The difficulties arise from the
>> fact that there are many people who don't know the recognized
>> standards/methods for certain things. Specifically, the methods used
>> to read documentation and the standards of usenet.
>
>True, but...
>
>If an infant doesn't know how to talk, do parents give up trying to
>teach them?
Well, to follow this analogy, should they tell the infant "go away for
a week or so and when you come back, maybe we'll help you"? :-/
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"i don't play lead. it interferes with my drinking." - Malcolm Young
------------------------------
Date: 23 Jun 2000 10:39:51 -0700
From: Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU>
Subject: Re: Dereferencing a two dimensional array?
Message-Id: <u5kvgz0i9eg.fsf@davis.DEMOG.Berkeley.EDU>
tadmc@metronet.com (Tad McClellan) writes:
> >
> >This line does NOT work:
> > @jr <= $re[$i];
>
> Turn on warnings. You have the wrong operator there.
>
> @jr , $re[$i]; # this is the same as what you have above
Are you sure? I think you're confusing => with <=. To my knowledge,
<= is only "less than or equal to".
--
---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography - University of California at Berkeley
2232 Piedmont Avenue #2120 - Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199
------------------------------
Date: Tue, 20 Jun 2000 14:55:47 GMT
From: nobull@mail.com
Subject: Re: Determining Dates
Message-Id: <U9ZOOHFWLA.FSF@WCL-L.BHAM.AC.UK>
reedjd@bitsmart.com writes:
> I'm attempting to write a Perl program that can determine if it is the
> last weekday of the month.
That's maybe the case but I do not believe that your difficulty is
actually Perl-related.
> Obviously I can use localtime(time) to figure out what day of the month
> it is and if it's a weekday or not, but is there any way in Perl to
> determine the total number of days a month taking leap years into
> account?
Well... given the localtime() and time() functions here's one way.
Please note I've coded this in Perl because this is a Perl newsgroup -
I still consider your question not to be Perl related as the answer
would be the basically same in C or any other language.
#!/usr/bin/perl -w
use strict;
# Using several redundant intermediate variables to aid readability.
my $now=time;
my ($hour,$mday,$wday) = (localtime($now))[2,3,6];
# Must go noon-ish to avoid any DST complications.
my $noonish_on_32nd_of_this_month =
$now + 3600 * ( 12 - $hour + 24 * ( 32 - $mday));
my $real_mday_of_32nd_of_this_month =
(localtime($noonish_on_32nd_of_this_month))[3];
my $days_this_month = 32 - $real_mday_of_32nd_of_this_month;
print $days_this_month;
__END__
BTW: There is a more direct approach to know if today is the last
weekday of the month - simply check that the next weekday is next
month!
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 19 Jun 2000 22:08:16 GMT
From: psycho <psychoNOpsSPAM@pcpatches.com.invalid>
Subject: Re: Dir Listsing
Message-Id: <00B8986A.5E310A78@USW-EX0102-013.REMARQ.COM>
sorrym i can't send the source code to any one b/c my firend im
dong this for, own's a co. sorry.
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: 23 Jun 2000 17:21:46 -0400
From: David Bolen <db3l@fitlinxx.com>
Subject: Forcing unbuffered stdout from command line?
Message-Id: <u4s6krt3p.fsf@ctwd0143.fitlinxx.com>
Does anyone know of a method to tell perl to treat stdout as an
interactive TTY even if it might otherwise think it wasn't?
I'm trying to take a system of scripts (which call each other in
several levels) and wrap them within a master script that traps all of
their normal output. The idea is to leave the existing system
untouched, but just wrap it so I can get access to the normal stdout
stream.
But of course, in doing so, stdout for the scripts changes from a
normal interactive session to a pipe. The new master script is still
running interactively, but it creates a pipe to the child process for
the other scripts to run in so it can "see" the output. This of
course changes the way stdout is buffered, and since the scripts tend
to produce small amount of output in advance of long running
operations, the output tends to get swallowed until the operation is
complete.
I realize that I can change the underlying scripts themselves to
autoflush stdout, but that requires editing an enormous number of
scripts. I can't just make the change top level since each underlying
script will just re-institute buffering, and I can't just change it at
lower levels for detail info, since that will reorder the output (the
higher level scripts tend to print preface information before running
the lower level scripts). I'm really trying to avoid having to go
through and add a command to every script just to be able to wrap the
existing system in the new executable, but am looking for an external
method to influence the default buffering choice perl is making.
The default perl behavior for interactive output is just fine, so I
was hoping that perhaps there was an undocumented method, or some
workaround to get perl to believe that its stdout was still an
interactive tty or to override its decision making process for that.
This is using perl 5.005_02 under Windows NT 4.0.
Thanks for any suggestions.
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l@fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
------------------------------
Date: Tue, 20 Jun 2000 02:44:35 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Getting current working directory in perl script
Message-Id: <NUA35.5313$FR2.61293@NEWS1.RDC1.MI.HOME.COM>
[Posted and mailed]
In article <121d1f18.9981ce59@usw-ex0106-045.remarq.com>,
glchy <glchyNOglSPAM@cc21.com.sg.invalid> writes:
> this is a simple question. I would like to get the current
> working directory in my perl script and unshift it in my @INC.
Maybe...
use Cwd;
unshift(@INC, cwd);
Now, you probably wanted this at compile time, didn't you? :)
Then why not just:
use lib '.';
This'll probably do what you want anyway. If you want to mess with @INC
extensively at compile time, look into BEGIN blocks.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Fri, 23 Jun 2000 20:41:35 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Hash keys
Message-Id: <3956c8d2.2732244@news.skynet.be>
Leena wrote:
>Are the following to lines equivalent?
There are no two follwoing lines, not even one, so yes, they are
equivalent.
>So, the
>question is whether it is bad practice (and if so, why) to use hash keys
>without the quotes when the hash key is meant to be a simple string?
You may, if the "simple string" is a bareword, i.e. usable as a simple
variable or sub name; and you should use "=>" instead of "," to separate
them. The "=>" makes sure that any bareword on the left side is indeed
taken literally.
$_ = ord 'A';
%a = ( chr , 123 );
%b = ( chr => 456 );
$, = " "; $\ = "\n";
print %a;
print %b;
-->
A 123
chr 456
See? In %a, the "chr" is taken as a function, and it's value is chr($_)
which, with the current value of $_, is "A". In %b, thanks to the "=>",
"chr" is taken literally.
--
Bart.
------------------------------
Date: Fri, 23 Jun 2000 23:04:29 +0100
From: "David Neupert" <dpeter@freenetname.co.uk>
Subject: Help - Brain Teaser
Message-Id: <8j0mrk$po9$1@gxsn.com>
Help
Does anyone know how to keep the downstate of an image even when you
leave the page (eg if i have a map of the UK and a dot that changes color
when clicked
i want it to stay on the down state even if someone leaves the page and
returns)
Someone suggested cookies can anyone help?
A response via E-Mail would be apreciated ksimm@globalnet.co.uk
Thanks Kevin
------------------------------
Date: Fri, 23 Jun 2000 21:04:55 GMT
From: abliss@mindspring.com
Subject: Help with s/ //g and s// /g
Message-Id: <1103_961794295@eratos>
OK, I'm a bit new to Perl, but I've done my best to assimilate the Docs and am still completely befuddled by this.
***PROGRAM:
$_="ABCD";
s// /g;
print "$_\n";
s/ //g;
print "$_\n";
print "----\n";
$_="ABCD";
s// /g;
print "$_\n";
s/ //g;
print "$_\n";
***OUTPUT:
A B C D
ABCD
----
ABCD
ABCD
Can someone tell me why the exact same block of code doesn't produce the same output the second time it is executed?
It seems that, somehow, executing "s/ //g;" anywhere in the script makes "s// /g;" never work again.
I have tried this on several different versions and several different machines with no change.
Thanks very much to anyone who can shed some light on this.
Adam Bliss
------------------------------
Date: 23 Jun 2000 21:47:13 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Help with s/ //g and s// /g
Message-Id: <8j0lt1$5jsum$9@fu-berlin.de>
hi,
abliss@mindspring.com wrote:
> OK, I'm a bit new to Perl, but I've done my best to assimilate the Docs and am still completely befuddled by this.
please set the column length of your newsreader to about 70
characters.
i can understand you, that's a weird problem.
> ***PROGRAM:
> $_="ABCD";
> s// /g;
> s/ //g;
> $_="ABCD";
> s// /g;
> s/ //g;
> ***OUTPUT:
> A B C D
> ABCD
> ----
> ABCD
> ABCD
read perldoc perlre on this:
"Repeated patterns matching zero-length substring"
then rewrite your code by replacing
> s// /g;
with
s/()/ /g;
enjoy,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."
------------------------------
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 3466
**************************************