[9624] in Perl-Users-Digest
Perl-Users Digest, Issue: 3218 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 21 18:07:20 1998
Date: Tue, 21 Jul 98 15:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 21 Jul 1998 Volume: 8 Number: 3218
Today's topics:
Re: Better way of saying this. <jdw@alder.dev.tivoli.com>
Re: Bug in regex quantifiers? (Ilya Zakharevich)
curses.pm addch() question (Peter Cox)
Re: DBD::Oracle for Oracle 8 (NT) <Eric.Zylberstejn@wanadoo.com>
Re: Eval Problem (Greg Bacon)
Re: Finding new files (create after a time stamp) <Eric.Zylberstejn@wanadoo.com>
Getting format with write to place spaces at the end of <sprugh@telution.com>
Re: Hiding input (Greg Bacon)
Re: how to pass by reference <Eric.Zylberstejn@wanadoo.com>
Re: how to pass by reference (Greg Bacon)
HTTP POST format Please Help me! <jrenna@bellsouth.net>
Re: Is there a location that I can lookup perl commands <melinda@acm.org>
Re: Looking for simple/dirty text editing scripts (Steve Linberg)
Re: Microsoft Support (Steve Linberg)
Re: newbie date format (Matt Knecht)
Perl / CGI scripting help needed. <tomh@ncfweb.net>
Perl 5.004_04 Configure script fails on Solaris... <cmason@transarc.com>
Re: regexp question merzky@physik.hu-berlin.de
Req Advice: per script to talk to lpd (Will Morse)
Re: return values for $^O jhildeb2@my-dejanews.com
Seleting multiple values in a checkbox (Harold J. Fennell)
Re: SMB and Timestamps <brentj@ext.msstate.edu>
Re: Sorting Lists of Lists (Greg Bacon)
Re: Sorting Lists of Lists (Greg Bacon)
Re: Subroutine Mystery <jdporter@min.net>
Re: Subroutine Mystery <maierc@chesco.com>
Re: use strict (M.J.T. Guy)
Re: Using splice with for (Greg Bacon)
What is Value of <HANDLE> ? <lavoie@zeus.genie.uottawa.ca>
Re: What's wrong? <jdporter@min.net>
Re: What's wrong? <jdporter@min.net>
Re: What's wrong? merzky@physik.hu-berlin.de
Re: What's wrong? (Greg Bacon)
Re: What's wrong? (Greg Bacon)
Win32 Net Resource <jason.lorsong@norfolkva.ncr.com>
Re: Win32 Net Resource (Jeffrey Drumm)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Jul 1998 14:56:56 -0500
From: Jim Woodgate <jdw@alder.dev.tivoli.com>
Subject: Re: Better way of saying this.
Message-Id: <obg1fvou47.fsf@alder.dev.tivoli.com>
"David Thompson" <domainsource@usa.net> writes:
> Pretty straightforward. Using my C++ experience I have the following
> code, which works, but probably isn't Perl elegant:
>
> ----------
> $teststring = "something"
> $allowed = "";
> @allowed = qw (mary joe bob);
> foreach $keystring (@allowed)
> {
> if ($teststring =~ /$keystring/i) {$allowed = "yup";}
> }
> unless ($allowed eq "yup") {die "Sorry, not found";}
> ----------
I don't know if it's easier or more elegant, but you can do the
foreach/unless in a one liner:
grep { $teststring =~ /$_/i } @allowed or die "Sorry not found, stopped";
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@tivoli.com
------------------------------
Date: 21 Jul 1998 20:41:30 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bug in regex quantifiers?
Message-Id: <6p2udq$7tt$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Eli the Bearded
<*@qz.to>],
who wrote in article <eli$9807211401@qz.little-neck.ny.us>:
> It basically boils down to \d{n,m} will find a match in any string
> that has at least n digits. If you want to enforce the m limit you
> must have suitable boundaries.
Which with older Perls may be written as
/(^|\D)\d{4,7}($|\D)/
and with 5.005 as
/(?<!\d)\d{4,7}(?!\d)/
(which is longer, but gives better $&).
Ilya
------------------------------
Date: 21 Jul 1998 21:06:12 GMT
From: pcox@unix2.megsinet.net (Peter Cox)
Subject: curses.pm addch() question
Message-Id: <slrn6ra0qq.h2d.pcox@unix2.megsinet.net>
Hi there,
I'm using perl5 with the Curses 1.02 module.
I have a datafile which consists of raw tcp packets in hex format, which
I want to play back a packet at a time (a la Shimomura). This all works
fine, until I went to create windows with Curses. Here's the problem:
Using the standard print function, everything is rosy - control
characters are interpreted correctly and there is no garbage on the
screen. However, using addch() from the Curses module, the control
characters are printed literally, so instead of getting a nice display,
the output is flooded with raw control sequences as shown below.
My question is how can I get curses to interpret these controls properly?
Example (beginning of pine session):
^[[1;24r^[[H^[[J^[[1;1H^[[7m PINE 3.96 MAIN MENU
Cheers,
Peter Cox
Sysadmin, Kellogg Information Systems,
Northwestern University
------------------------------
Date: Tue, 21 Jul 1998 22:44:27 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
Subject: Re: DBD::Oracle for Oracle 8 (NT)
Message-Id: <35B4FDAB.286EC84F@wanadoo.com>
Hello,
gloriat44@my-dejanews.com wrote:
> I have just installed Oracle 8 and I didn't have a previous version already
> installed on the Windows NT server.
>
> I have followed the discussions about the DBD::Oracle drive and its use with
> oracle 8. I have installed DBI - 0.90 and been trying (with no success) to
> install DBD - Oracle 0.47.
I suggest you upgrade to the lastest versions : DBI 0.93, DBD::Oracle 0.93.
> The problem is that I don't have any oracle.mk
> file. Actually there's no trace of any *.mk file in the Orant directory nor
> on the Cd-Rom.
>
> What can I do to install the DBD - Oracle interface? Is there anybody that has
> already had this same problem?
Did you install the Pro*C option ?
Please note that I have never tried to compile DBD::Oracle with Oracle 8
includes/libraries.
Eric
------------------------------
Date: 21 Jul 1998 20:31:10 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Eval Problem
Message-Id: <6p2tqe$8it$6@info.uah.edu>
In article <admin-ya02408000R2107981203560001@news.smartlink.net>,
admin@the-signal.com (Paul Sisson) writes:
: I attempted to build the file search into an eval, but when run it dies
: with the error message, "Can't modify scalar ref constructor in scalar
: assignment at (eval 1) line 1, near "$1)"
[snip]
: sub search {
: my ($str,$file,%mtime,@found,$search);
:
: $search = 'while (<>) { study;';
: $search .= 'm{$TITLE_PAT}os && (\$title{\$ARGV} = \$1);';
Your problem is that you're feeding bad data to eval(). Consider:
main::(-e:1): 0
DB<1> $search = 'while (<>) { study;';
DB<2> $search .= 'm{$TITLE_PAT}os && (\$title{\$ARGV} = \$1);';
DB<3> print $search
while (<>) { study;m{$TITLE_PAT}os && (\$title{\$ARGV} = \$1);
Perl won't let you do things like
\$foo = 'value';
Gid rid of the backslashes inside the single quotes (backslash only
quotes single quotes inside single quotes).
When I'm running into trouble with code that I've computed at runtime,
I often find it helpful to print out the code just before the call to
eval so I can check it for any obvious errors.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 21 Jul 1998 22:21:41 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
Subject: Re: Finding new files (create after a time stamp)
Message-Id: <35B4F855.7B1153A6@wanadoo.com>
Hello,
drubin@gatekeeper.cb.att.com wrote:
> What is the best way (using ksh or perl) to find all files in a directory
> created after a timedate stamp (such as 07/20/98:10:10)? I was hoping this
> would be simple, but I keep coming up with very messy solutions.
You can try find2perl to get an example. Unfortunately, it doesn't use the
File::Find package, but the older find.pl library.
Eric.pl
------------------------------
Date: Wed, 15 Jul 1998 13:04:39 -0500
From: "Scott T. Prugh" <sprugh@telution.com>
Subject: Getting format with write to place spaces at the end of line?
Message-Id: <6oiqt3$m5h$1@seletar.ap.deuba.com>
Take the following example:
format FOO =
@<<<<< @<<<<< @<<<<<<<<<<<
$id,$name,$spaces
.
$id="130";
$name="bar";
$spaces = " "; # 12 spaces
$~ = "FOO";
write;
My output is
130 bar
without the spaces.
I need the spaces as a filler. How would I do this?
Regards,
Scott
------------------------------
Date: 21 Jul 1998 21:26:11 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Hiding input
Message-Id: <6p311j$8it$15@info.uah.edu>
In article <19980721185145.AAB15012@sub.internetx.net>,
rick@internetx.net ("Rick Bauman") writes:
: How can I keep the users input from echoing back to his screen?
The answer to your question lies in the fine perlfaq8 manpage. Search
for `How do I ask the user for a password?'.
: How can I make it echo back as a series of characters such as the *
You could probably do this with the Term::ReadKey module.
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 21 Jul 1998 22:17:49 +0200
From: Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com>
Subject: Re: how to pass by reference
Message-Id: <35B4F76D.3D8C26E0@wanadoo.com>
Hello,
> Pass-by-reference is not the same as passing a reference by value.
Got it.
However, I'm not sure it is a good recommendation to use this $_[0] stuff.
Looks too hackish. And difficult to maintain. Although I now know this can be
used (and this is probably fast), I won't use it. I prefer an explicit call
with a reference. And as someone replied, it gets scary if you want to pass
arrays or hashes.
Eric.pl
------------------------------
Date: 21 Jul 1998 21:14:45 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: how to pass by reference
Message-Id: <6p30c5$8it$11@info.uah.edu>
In article <35B4F76D.3D8C26E0@wanadoo.com>,
Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com> writes:
: However, I'm not sure it is a good recommendation to use this $_[0] stuff.
: Looks too hackish. And difficult to maintain. Although I now know this can be
: used (and this is probably fast), I won't use it. I prefer an explicit call
: with a reference. And as someone replied, it gets scary if you want to pass
: arrays or hashes.
I agree. It's evil to modify someone else's data unless you've told
them beforehand that you're going to. This includes $_! It's quite
nice to localize $_ and friends if you must modify them. Did I mention
that $_[$idx] have little mnemonic and readability value? :-)
If you pass someone a reference or a glob, I think that's an implicit
way of saying `modify this if you want'. One can hand off a copy, after
all.
Greg, a definite parameter copier
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 14 Jul 1998 16:58:10 GMT
From: "John" <jrenna@bellsouth.net>
Subject: HTTP POST format Please Help me!
Message-Id: <C6Mq1.1673$yt4.821042@seletar.ap.deuba.com>
Hi,
Does anyone know how to do an HTTP Post to a search engine using the HTTP
protocol. I know the format is something like this but I am missing
something where $HTTPDEF is in the request string below: This is an example
tme trying to submit an URL to excite, but of course the HTTPDEF needs
information.
Can anyone help me please?
http://www.excite.com/POST /cgi/add_url.cgi
$HTTPDEFurl=http://www.jvprofit.com/jrdir/credit/creditresource.htm&emailjre
nna@bellsouth.net&look=excite
My email is jrenna@bellsouth.net
------------------------------
Date: Tue, 21 Jul 1998 20:15:48 GMT
From: "Quinn,M" <melinda@acm.org>
Subject: Re: Is there a location that I can lookup perl commands?
Message-Id: <35B4F8CF.F6F066CE@acm.org>
Re: "date" in perl - see article from
"Quinn,M" on Saturday about 20:50.
(This assumes you are using a Unix/Linux system.)
Melinda Quinn melinda@acm.org
>
> David Freed (dfreed@ns1.com) wrote:
> > I want to know how to get the current date in perl. While I was
> Aaron B. Dossett | Finger aarond@london.cslab.uky.edu for PGP key
> dossett@bigfoot.com|
> Comp. Sci. Senior | http://www.ewl.uky.edu/~aarond
> University of Kentucky 1996 & 1998 NCAA Basketball Champions
------------------------------
Date: Tue, 21 Jul 1998 16:45:47 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Looking for simple/dirty text editing scripts
Message-Id: <linberg-2107981645470001@projdirc.literacy.upenn.edu>
In article <35AB72AB.4B7CCFBF@seletar.ap.deuba.com>, "D. Kevin Kauzlarich"
<dkk7927@mail.ks.boeing.com> wrote:
> Does anyone know a good place to find simple and quick text editing
> scripts?
> I'm quite new at using Perl and would like to learn by example while
> making my
> life a little easier .......
>
> What I'm specifically looking for is a way to insert one text file into
> a base file
> at marker points.
>
> Probably a simple operation for you guys, but for me well ..........
Very simple. Here's one way:
file1.txt:
This is a file.
I want to insert another text file below this line.
<!--file here-->
The inserted file should be above.
EOF
foo.pl:
#!/usr/bin/perl -w
use strict;
open FILE1, "file1.txt" or die "Can't open file1: $!";
my @file1lines = <FILE1>;
close FILE1;
my $file1 = join("", @file1lines);
open FILE2, "file2.txt" or die "Can't open file2: $!";
my @file2lines = <FILE2>;
close FILE2;
my $file2 = join("", @file2lines);
$file1 =~ s/<!--file here-->/$file2/s;
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Tue, 21 Jul 1998 16:33:21 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Microsoft Support
Message-Id: <linberg-2107981633210001@projdirc.literacy.upenn.edu>
In article <6p23nb$sa5$1@newsource.ihug.co.nz>, "Phil Evans"
<phile@ihug.co.nz> wrote:
> Hi,
>
> Do Microsoft engineers ever look at the microsoft.public.vc.* newsgroups
> ????
Good question. Why don't you ask in microsoft.public.vc.*?
Newsgroups trimmed, followups set.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Fri, 17 Jul 1998 18:18:11 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: newbie date format
Message-Id: <DzMr1.144505$on1.7842514@seletar.ap.deuba.com>
Larry Rosler <lr@hpl.hp.com> wrote:
>Odd that you should prefer quick and dirty to quick and clean.
>
>#!/usr/local/bin/perl -w
>use Benchmark;
>
>$x = '1';
>
>timethese(1 << (shift || 0), {
> Clean => sub { $_ = sprintf '%.2d', $x },
> Dirty => sub { $_ = (length($x) < 2 && '0') . $x },
>});
>__END__
>
>Benchmark: timing 65536 iterations of Clean, Dirty...
> Clean: 2 secs ( 1.68 usr 0.01 sys = 1.69 cpu)
> Dirty: 6 secs ( 1.71 usr 0.02 sys = 1.73 cpu)
I agreed to quickly with your alternative to my solution. We need to
add my original back into the fray:
timethese(1 << (shift || 0), {
Clean => sub { $_ = sprintf '%.2d', $x },
Dirty => sub { $_ = (length($x) < 2 && '0') . $x },
Orig => sub { $_ = $x+1 < 10 ? $x : '0'.$x },
});
Which gives me:
Benchmark: timing 65536 iterations of Clean, Dirty, Orig...
Clean: 10 secs ( 6.56 usr 0.00 sys = 6.56 cpu)
Dirty: 6 secs ( 4.54 usr 0.00 sys = 4.54 cpu)
Orig: 6 secs ( 3.97 usr 0.00 sys = 3.97 cpu)
The difference between run times on identical code on two different
machines is disturbing. I ran the same test with a higer count to get a
better look:
Benchmark: timing 262144 iterations of Clean, Dirty, Orig...
Clean: 29 secs (27.34 usr 0.00 sys = 27.34 cpu)
Dirty: 19 secs (19.07 usr 0.00 sys = 19.07 cpu)
Orig: 16 secs (15.95 usr 0.00 sys = 15.95 cpu)
On my machine (Sparc 2 *shudder*) the sprintf solution takes almost
twice as long as using ?:. Out of curiousity, what platform did you run
that on?
>> Ideally I'd bury something like the above in a #define, but I haven't
>> got the heart to litter my Perl code with pre-processor statements...
>> yet :)
>
>Gag me!
Well, I really do miss the convienence of inlining small functions, and
truly constant constants that it gives.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: 14 Jul 1998 21:42:05 GMT
From: "Tom Hicks" <tomh@ncfweb.net>
Subject: Perl / CGI scripting help needed.
Message-Id: <01bdaf71$45304b00$b87895cf@seletar.ap.deuba.com>
Keywords: help wanted, perl, cgi
Hi,
I have and or find perl / cgi scripts online. Some of them I can get to run. Some I can not get
to run. The people that write the scripts are clueless about support. Any consultants out there
that would be interested in helping this bozo out. How much $$$?
Currently I have a need to get the following to work here.
Links
A YAHOO like directory.
http://www.gossamer-threads.com/
Links is installed and used to work but currently will not add a post.
MailMan
Web based Email setup
http://www.endymion.com/
It is more or less installed here. The OS layout and I don't get along and need someone to show me
how to effectively work with http://amber.he.net/cgi-bin/suid/~myaccount
And others now possibly and or in the future if I am not drained alive $$$ wise :)
Thanks for your time.
Tom Hicks
tomh@ncfweb.net
InternetTemps.com
Cyber Skills Exchange Free Listings
http://www.internettemps.com
Idowebs.com
------------------------------
Date: Tue, 21 Jul 1998 17:28:03 -0400
From: Chris Mason <cmason@transarc.com>
To: perlbug@perl.com, cmason@transarc.com
Subject: Perl 5.004_04 Configure script fails on Solaris...
Message-Id: <35B507E3.2855A9E8@transarc.com>
I grabbed 5.004_04 off CPAN, untarred, ran sh Configure. It just dies at
the prompt:
Which of these apply, if any? [solaris_2]
I followed instructions to the letter. I think this is a problem with the
read code in the shell scripts. If I type stuff at this prompt, it doesn't
get echoed back. However, it seems like it's getting evaled somehow. If I
type
perl -e 'print STDERR "foo"'
I get ``foo'' echoed back to my terminal. I can hit ^C to get out of the
Configure script. I'm not making this up.
I've tried running the Configure script to sh with -v and it doesn't doing
anything after that prompt. Nothing I type at that prompt will get it to
continue.
uname -a gives:
SunOS trullo 5.5.1 Generic_103640-18 sun4u sparc SUNW,Ultra-1
This is very strange. I would appreciate any help here...
-c
--
[ Chris Mason cmason@transarc.com cmason@cmu.edu http://ros.res.cmu.edu ]
[ "He will debauch himself with ideas... if for only one second of his ]
[ life he can close his eyes to the hideousness of reality." -- Miller ]
------------------------------
Date: Tue, 21 Jul 1998 21:05:34 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: regexp question
Message-Id: <6p2vqu$bko$1@nnrp1.dejanews.com>
In article <t07m17e3bx.fsf@hcirisc.cs.binghamton.edu>,
Tim Gray <tim@hcirisc.cs.binghamton.edu> wrote:
>
> I am trying to come up with a regexp that will match the size
> attribure in an HTML <FONT> tag and am failing miserably.
>
> Why doesn't this expression
> m/<font.*?\s(SIZE=.*?)[>\s]/
>
> match this string?
> <font COLOR="#006600" SIZE="+1">
>
> I know that '<font' matches. Then match all the characters up until
> the first instance of a whitespace character folowed by 'SIZE='. Then
> match what the size is set to, then match the end of the attribute
> because or the whitespace or match the end of the tag '>'.
>
> I am trying to write a one-liner that will go through and remove all
> the relative font sizes from a web site. Any help is appreciated.
> Thanks.
>
> Tim Gray
>
Hmm, strange, for me it works:
#!/usr/bin/perl -w
use strict;
my ($string) = "<FONT COLOR=\"#006600\" SIZE=\"+1\">";
print "String: '$string'\n";
if ($string =~ /<font.*?\s(SIZE=.*?)[>\s]/i) {
print "matched: '$1'\n";
} else {
print "no match...\n";
}
gives:
[am] merzky /tmp : ./test.pl
String: '<FONT COLOR="#006600" SIZE="+1">'
matched: 'SIZE="+1"'
I guess it's not because of the /i :-)
Andre.
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 21 Jul 1998 20:22:59 GMT
From: wtm001@anadarko.com (Will Morse)
Subject: Req Advice: per script to talk to lpd
Message-Id: <EwGoMC.Jy2@anadarko.com>
Hi,
I have a need for a special interface for sending
rasterized plot files to an HP plotter that has some
kind of an lpd interface.
The obvious candidate would, of course, be lpr, but I
A. Am using Solaris (SysV lp)
B. Need some special load balencing functions
C. Need some special accounting functions.
D. Need to interface to rasterizing software.
So I have looked at LPRng and Solstice print client,
and these are really wonderful sledgehammers but what
I am really needing is a tap hammer.
Naturally, my thoughts turn to perl.
Now, maybe I could do what I need using some kind of
input or output filter and still use lpr, but I am
hoping to short circuit the process since what I need
is really focussed on only one type of file going to
one group of plotters all of the same type, and I would
like to have good control of what plotter is busy, and how
busy, etc. so I can decide which plotter to queue to.
So I have the LPRng source which does an excellent job
of documenting the send job protocol and, while I have
never written a perl program to use sockets before, it
is obvious that it has the capability.
The printcap and accounting piece are simple as long as
I have access to the data as it happens. The big
trick, at least for me, is talking over the socket to
the lpd on the plotter.
Has anyone done something like this before?
If so, do you have any suggestions that would help
me avoid reinventing the wheel?
Thanks in advance
Will
--
Will Morse | This is a statement of opinion
| even if stated as a fact.
Gravity |
Not just a good idea | Copyright 1998, Will Morse
It's the law | Okay to quote/archive on internet.
| Newsmedia quoting requires permission.
------------------------------
Date: Tue, 21 Jul 1998 20:55:44 GMT
From: jhildeb2@my-dejanews.com
Subject: Re: return values for $^O
Message-Id: <6p2v8g$b0a$1@nnrp1.dejanews.com>
Under Windows NT 4.0 the return value is MSWin32.
Jim Hildebrand
In article <6oupob$fjl$1@holly.prod.itd.earthlink.net>,
"Brent Verner" <REPLY_TO_damonbrent@earthlink.net> wrote:
> could anyone out there tell me, in particular, the $^O values for operating
> systems that use \r\n as record separators such as NT. i'm on linux, so
> that is the only $^O that i can see.
>
> thanks much,
>
> brent
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 21 Jul 1998 20:25:51 GMT
From: harold@spectra.net (Harold J. Fennell)
Subject: Seleting multiple values in a checkbox
Message-Id: <6p2tff$t29$1@supernews.com>
I am trying to use the following code to load the contents of a chekcbox_group
but I am unable to get anything checked. I would appreciate any help that you
can supply in this matter.
@t=(split(',', shift(@values)));
print $query->checkbox_group(-name=>'Clinical hx type',
-values=>['acute', 'trismus',
'MMR to acute', 'biopsy', 'questionable', 'unknown', 'N\A'],
-default=>\@t,
-columns=>4);
I know that @t is getting the values it should receive. What am I doing wrong
here?
-------------------------------------------------------------------------------------
- Harold J. Fennell Phone: 607-693-3304 -
- Advanced Research Labs Fax: 607-693-4250 -
- P.O. Box 56 E-mail: harold@spectra.net-
- Nineveh, NY 13813 -
- Internet Consultant -
-------------------------------------------------------------------------------------
------------------------------
Date: 15 Jul 1998 18:22:41 GMT
From: Brent Johnson <brentj@ext.msstate.edu>
Subject: Re: SMB and Timestamps
Message-Id: <6ois1h$e28$1@seletar.ap.deuba.com>
In comp.protocols.smb Larry Rosler <lr@hpl.hp.com> wrote:
> In article <6oil31$aph$1@nntp.msstate.edu> on 15 Jul 1998 16:24:01 GMT,
> Brent Johnson <brentj@ext.msstate.edu> says...
>> I am trying to write a Perl script which scans through a common
>> public directory and moves any files older than a certain date
>> to another directory. Problem is, when someone saves a file to
>> a mounted SMB filesystem, it keeps the original file date.
>>
>> Is there a way to 'touch' files when they are copied? Or some
>> other way? I've looked at the creation times (same as it is
>> on their PC's), modified times (no help there) and the 'atime' ..
>> which I have no idea what that is.. but it isnt correct.
>>
>> Any help would be appreciated,
>>
>> - Brent
> Look at `perldoc -f utime`. The utime() function should let you do what
> you want, and is OS-independent, whereas the `touch` command is OS-
> dependent.
Thanks, but that does not answer my original question. I used 'touch'
in the simplest terms, I did not mean an actual 'touch'. I will
rephrase it .. when users copy files from their local hard
drives to their SMB mounted drives (using samba for solaris), the files
have the same timestamp as they did when they were on their harddrives.
I want the time the files were actually created on the system - and
ctime, mtime nor atime seem to show me that information.
- Brent
------------------------------
Date: 21 Jul 1998 20:22:14 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Sorting Lists of Lists
Message-Id: <6p2t9m$8it$5@info.uah.edu>
In article <35b4d3eb.87227264@news.vnet.net>,
bhoyle@huntersville.org writes:
: What I need to do is add another field in each record to indicate the
: ranking of the fourth field in relation to all the other records. The
: final text file needs to look like this:
:
: field1|field2|field3|34.2|23.1|2.4|3
: field1|field2|field3|48.3|12.2|9.8|4
: field1|field2|field3|27.8|32.9|6.7|2
: field1|field2|field3|16.3|45.8|5.1|1
:
: The last field is the rank based on the fourth field.
Something like this?
#! /usr/bin/perl -w
use strict;
my $data = <<EOData;
field1|field2|field3|34.2|23.1|2.4|
field1|field2|field3|48.3|12.2|9.8|
field1|field2|field3|27.8|32.9|6.7|
field1|field2|field3|16.3|45.8|5.1|
EOData
## split data out into @array
my @array = map { [ split /\|/ ] } split /\|\n/, $data;
my %rank;
my $i = 1;
my @sorted = map { $_->[0] }
sort { $a->[1] <=> $b->[1] } # sort @array
map { [ $_, $_->[3] ] } # keying on field 4
@array;
## assign ranks
for (@sorted) { $rank{$_} = $i++ }
## ...and add them to the arrays
for (@array) { push @$_, $rank{$_} }
for (@array) {
print join("|", @$_), "\n";
}
Notice the slightly sneaky trick of using the stringified versions of
references as keys to the %rank hash, for example
% perl -le 'print []'
ARRAY(0x100ccc50)
Hash keys are always strings, so they lose the magic bits that make them
references (and there's no way to convert a string back to reference),
but it works fine as a unique identifier.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 21 Jul 1998 21:23:12 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Sorting Lists of Lists
Message-Id: <6p30s0$8it$14@info.uah.edu>
In article <6p2t9m$8it$5@info.uah.edu>,
gbacon@cs.uah.edu (Greg Bacon) writes:
: my @sorted = map { $_->[0] }
: sort { $a->[1] <=> $b->[1] } # sort @array
: map { [ $_, $_->[3] ] } # keying on field 4
: @array;
After reading Eric's article, I realized that this was *gross* overkill.
TMTOWTDI. :-(
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 21 Jul 1998 20:39:58 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Subroutine Mystery
Message-Id: <35B4FE3A.6B52@min.net>
monty hindman wrote:
>
> # Doesn't work.
> sub Go ;
> Go ;
> print "$x @y \n" ;
> sub Go {
> $x = 1 ;
> @y = (1, 2, 3) ;
> }
Works for me (perl 5.004_04).
What does your perl -v say?
--
John Porter
------------------------------
Date: Tue, 21 Jul 1998 20:41:01 GMT
From: Charles Maier <maierc@chesco.com>
Subject: Re: Subroutine Mystery
Message-Id: <35B3732B.5F4B6363@chesco.com>
The rules clearly state you can only leave off the "&" from the call to
subroutine if the subroutine is defined before the call. Personally.. I
feel it is bad form in either case.. but that is IMOP.
--
Chuck Maier
CDM Consulting Services
http://www.cdmcon.com
(610) 943-2726
monty hindman wrote:
> Can anyone tell me why the second program gives a compiling error?
>
> # Works.
> sub Go {
> $x = 1 ;
> @y = (1, 2, 3) ;
> }
> Go ;
> print "$x @y \n" ;
>
> # Doesn't work.
> sub Go ;
> Go ;
> print "$x @y \n" ;
> sub Go {
> $x = 1 ;
> @y = (1, 2, 3) ;
> }
> --
> =======================
> Monty Hindman
> 8500 S.W. Canyon Dr. #8
> Portland, OR 97225
> (503) 291-1752
> montyh@umich.edu
> =======================
------------------------------
Date: 15 Jul 1998 18:07:56 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: use strict
Message-Id: <6oir5s$ihc$1@seletar.ap.deuba.com>
In article <6oio53$gbn$1@ocean.cup.hp.com>, Gil Brown <gil_brown@hp.com> wrote:
>I trying to learn perl5 (I've only written stuff in 4 so far) and I am
>having a problem with use strict. All I want to do is read from a file
>(simple enough) and when I uncomment use strict nothing works and it does
>when I comment it.
While developing scripts, and especially when trying to something like
make an old script "use strict" clean, I strongly suggest you
include early on
use diagnostics;
(or put -Mdiagnostics on the command line). Then Perl will provide
an expanded explanation of the problem. In your case, you would have
got
Global symbol "$line" requires explicit package name
(F) You've said "use strict vars", which indicates that
all variables must either be lexically scoped (using
"my"), or explicitly qualified to say which package the
global variable is in (using "::").
which shows you two ways of fixing the problem. (You probably want to
go the "my" route.)
Mike Guy
------------------------------
Date: 21 Jul 1998 20:37:34 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Using splice with for
Message-Id: <6p2u6e$8it$7@info.uah.edu>
In article <4U5t1.94$dm.5926815@news3.voicenet.com>,
hex@voicenet.com (Matt Knecht) writes:
: I have the need to search an array[1] for a specific element, and remove
: it. splice seems like the natural way to accomplish this, however, I'm
: stuck with a C style for loop when trying to find the offset where I
: want to splice at. Sample:
:
: for (my $x = 0; $x < @array; $x++) {
: splice(@array, $x, 1), last if $array[$x] eq 'condition';
: }
:
: This works for what I need, but, this seems like a very non-Perlian way
: to go about getting what I need. I've considered using:
:
: @array = grep { $_ ne 'condition' } @array;
:
: But that seems excessive. My question is: Has anybody else come up with
: an elegant solution to this?
What's wrong with the grep? It looks nice, and its purpose is quite
clear. Unless there is something really funny going on under the hood,
it executes in linear time (please correct me if I'm wrong, Abigail :-).
The splice method would only be faster for very large arrays.
If you're really worried about eating up too much memory, you could do
something like
my @checked;
for (@unchecked) {
push @checked, $_ unless $_ eq 'condition';
}
but I suspect it would be slower than the grep.
Decide whether you'd rather optimize for speed or memory use and
benchmark accordingly.
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 21 Jul 1998 16:24:09 -0400
From: Lavoie Philippe <lavoie@zeus.genie.uottawa.ca>
Subject: What is Value of <HANDLE> ?
Message-Id: <y6emvfneae.fsf@zeus.genie.uottawa.ca>
In my program I get a lot (4) of this message
Value of <HANDLE> construct can be "0"; test with defined() at cppdoc.pl line 65535.
My program is not 65535 lines of code, so I'm a bit confused as to why
I'm receving this error message.
Any help on that matter would be appreciated.
Phil
PS Can you CC a copy of your answer to my e-mail address ? Thanks.
------------------------------
Date: Tue, 21 Jul 1998 20:30:10 GMT
From: John Porter <jdporter@min.net>
Subject: Re: What's wrong?
Message-Id: <35B4FBF1.697D@min.net>
Wilson Henriquez wrote:
>
> I'm starting to learn perl from Learning Perl(O'reilly), and I am
> having trouble. I'm running Linux and use joe to create a text file
> named ex. In ex I put the following code,
> #! /usr/bin/perl
> print ("Hello, world!\n");
> Then I save the file and do, chmod +x ex. Next I try to run the
> exeecutable file I get the message "print not found". What am I doing
> wrong?
You happened to pick a name for program that is "already taken".
Name your file something more likely to be unique, like
"henriquez_test_001". "test" is another name that frequently trips
people up. Even if you pick something that you think should be safe,
like "foo", try to determine before-hand if it is already used.
If you use csh, check out the "which" command, for example.
btw, ignore what Yong Huang said. He's wrong.
--
John Porter
------------------------------
Date: Tue, 21 Jul 1998 20:31:43 GMT
From: John Porter <jdporter@min.net>
Subject: Re: What's wrong?
Message-Id: <35B4FC4E.29BD@min.net>
j wrote:
>
> #!/usr/bin/perl
> not
> #! /usr/bin/perl
Did you actually test this assertion, before posting?
On my machine (solaris 2.4), the space makes absolutely no difference.
--
John Porter
------------------------------
Date: Tue, 21 Jul 1998 21:13:46 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: What's wrong?
Message-Id: <6p30ab$c1u$1@nnrp1.dejanews.com>
In article <6p24ja$smg$1@news.smart.net>,
hymie@lactose.smart.net (hymie!) wrote:
> In our last episode, the evil Dr. Lacto had captured our hero,
> Wilson Henriquez <henrwi00@usfca.edu>, who said:
> > I'm starting to learn perl from Learning Perl(O'reilly), and I am
> >having trouble. I'm running Linux and use joe to create a text file
> >named ex. In ex I put the following code,
>
> Here might be your first problem -- it's a bad idea to use an existing
> command name for programs you write. Double-check to ensure that,
> when you run "ex", you are running the program you wrote, rather than
> the system command.
Actually, I am using 'test' for all of my test programs, inspite of the
existence of /usr/bin/test, which is well known. A friend of mine used to
tease me 'cause of this, and usually why I didn's use 'probe', like he does,
and which is far more secure.
It took him several hours to find that a program package he installed
once also had installed a small script probe, which did not give any
ootput and did not do very much anyway. I always start to grin if I remember
this day, since I was sitting behind him, watching his debugging... :-)
There is no problem to use such names as test, ex, vi, shutdown, rm, whatever.
You have to make this KNOWINGLY. And you have to use ./ex :-)
Anyway, ex does not explain Wilsons error message. This rather comes from
the space in the first line, which prevents from calling perl at all. This
actually seems to work on some systems/shells. Does anyone know who is
interpreting this?
Andre.
> ..hymie! http://www.smart.net/~hymowitz
hymie@lactose.smart.net
> Seems I'm not alone at being alone -
> A hundred billion castaways looking for a home.
--Sting
>
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 21 Jul 1998 21:19:38 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: What's wrong?
Message-Id: <6p30la$8it$13@info.uah.edu>
In article <35B4FBF1.697D@min.net>,
John Porter <jdporter@min.net> writes:
: You happened to pick a name for program that is "already taken".
: Name your file something more likely to be unique, like
: "henriquez_test_001". "test" is another name that frequently trips
: people up. Even if you pick something that you think should be safe,
: like "foo", try to determine before-hand if it is already used.
: If you use csh, check out the "which" command, for example.
...or just use ./ex
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 21 Jul 1998 21:18:29 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: What's wrong?
Message-Id: <6p30j5$8it$12@info.uah.edu>
In article <35b4708a.30091175@nntp.best.com>,
jjones@nospam.elementdesign.com (j) writes:
: #!/usr/bin/perl
: not
: #! /usr/bin/perl
I read somewhere (I think of GNUish origin) that the bespaced variety
of the shebang is more portable. Can anyone verify or debunk this?
Personally, I think the latter looks a little nicer (it's what I use
in my code).
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: Tue, 21 Jul 1998 15:55:16 -0400
From: "Jason Lorsong" <jason.lorsong@norfolkva.ncr.com>
Subject: Win32 Net Resource
Message-Id: <eQlkHROt9GA.148@rpc1285.daytonoh.ncr.com>
Where do I find the correct syntax for connecting to a shared drive on a
remote server. I am using the Win32::NetResource module. The symtax is not
explained very well. Is LOCALNAME the drive letter I would like it to be?
Is PROVIDER the remote machine name via UNC? Is REMOTE NAME the share name?
HEEELP!!!
My current script:
use Win32::NetResource;
%NETRESOURCE = {
'Scope' => RESOURCE_CONNECTED,
'Type' => RESOURCETYPE_DISK,
'DisplayType' => RESOURCEDISPLAYTYPE_SHARE,
'Usage' => RESOURCEUSAGE_CONNECTABLE,
'LocalName' => y,
'RemoteName' => d$,
'Comment' => A,
'Provider' => vabbdc9,
};
--
Jason Lorsong (newbie)
------------------------------
Date: Tue, 21 Jul 1998 21:24:52 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Win32 Net Resource
Message-Id: <35b5034a.8721559@news.mmc.org>
[posted and mailed]
On Tue, 21 Jul 1998 15:55:16 -0400, "Jason Lorsong"
<jason.lorsong@norfolkva.ncr.com> wrote:
>Where do I find the correct syntax for connecting to a shared drive on a
>remote server. I am using the Win32::NetResource module. The symtax is not
>explained very well. Is LOCALNAME the drive letter I would like it to be?
>Is PROVIDER the remote machine name via UNC? Is REMOTE NAME the share name?
>HEEELP!!!
>
>My current script:
>
>use Win32::NetResource;
>
>%NETRESOURCE = {
>
> 'Scope' => RESOURCE_CONNECTED,
> 'Type' => RESOURCETYPE_DISK,
> 'DisplayType' => RESOURCEDISPLAYTYPE_SHARE,
> 'Usage' => RESOURCEUSAGE_CONNECTABLE,
> 'LocalName' => y,
> 'RemoteName' => d$,
> 'Comment' => A,
> 'Provider' => vabbdc9,
>};
You can start by checking DejaNews (http://www.dejanews.com). There you'll
find at least half a dozen posts by yours truly that show working examples.
Search on Win32::NetResource and my name.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3218
**************************************