[11115] in Perl-Users-Digest
Perl-Users Digest, Issue: 4715 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 21 20:06:11 1999
Date: Thu, 21 Jan 99 17:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 21 Jan 1999 Volume: 8 Number: 4715
Today's topics:
Re: ** Seems Like a Natural for Perl ** (Rich)
Re: Am I wrong about Symbolic References? <aqumsieh@matrox.com>
Re: dbmopen vs. tie (Bill Moseley)
Re: dereference entire array of array references (Tad McClellan)
Re: Difficult issues not suitable for this newsgroup? (Tad McClellan)
Re: Difficult issues not suitable for this newsgroup? birgitt@my-dejanews.com
Re: finding dirs with readdir <bgilbert@sgi.com>
Re: handling STDERR in open() <aqumsieh@matrox.com>
Re: Help with RE for separate Perl codes and comments <aqumsieh@matrox.com>
Re: How long would the Unixes last without Perl? (Alastair)
length($string) in UNIX environment <charlesjourdan@worldnet.att.net>
Re: list of hashes dhosek@webley.com
Re: Looking for free Web Server with CGI (Harold Bamford)
Re: Looking for free Web Server with CGI <cdkaiser@delete.these.four.words.concentric.net>
newbie: looking for script to send a form to a printer <kf4dmb@camcomp.com>
open() "bad file number" help! cometsoft@yahoo.com
Re: Pattern match behaves strangely (Richard Rowell)
Re: pattern matching (details) (Tad McClellan)
Re: pattern matching (details) (Alastair)
Re: pattern matching trouble <aqumsieh@matrox.com>
Re: perl script error kamez@my-dejanews.com
Re: perl script error (Alastair)
Re: PERL Security Issues (Greg Ward)
Problems whit Perl and NT Option Pack <roberto@iee.efei.br>
Re: Problems whit Perl and NT Option Pack <cdkaiser@delete.these.four.words.concentric.net>
Random Invoice # <hitbyabus@mindspring.com>
Re: Regex challenge <rick.delaney@home.com>
Re: Running -T (Greg Ward)
Re: Secuity hole with perl (suidperl) and nosuid mounts (Michael Van Biesbrouck)
Trying to match a variable with another variable. <cpuweb@cpuweb.com>
Re: Ubiquitous Script <aqumsieh@matrox.com>
Re: Y2K? (Tad McClellan)
Re: Yet another basic question. <aqumsieh@matrox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Jan 1999 00:14:12 GMT
From: richm@ucesucks.rochester.rr.com (Rich)
Subject: Re: ** Seems Like a Natural for Perl **
Message-Id: <slrn7afgs2.krh.richm@ll.aa2ys.ampr.org>
On 21 Jan 1999 08:56:56 -0500, David W. Bourgoyne <david.bourgoyne@bigfoot.com> wrote:
( Using perl deleted )
Or, you could use Fetchmail, and have it running in about
30 seconds after installation. :-)
- Rich
--
Rich Mulvey
http://mulvey.dyndns.com
Amateur Radio: aa2ys@wb2wxq.#wny.ny.usa
------------------------------
Date: Thu, 21 Jan 1999 14:59:05 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Am I wrong about Symbolic References?
Message-Id: <x3yk8ygo0s7.fsf@tigre.matrox.com>
Burton Kent <burton@mcs.net> writes:
> I'm trying to use symbolic references to print a list of
> variables. A vastly simplified listing follows.
>
> My question is, how am I misunderstanding symbolic references?
> According to my Camel book, this code should work!
It should ... but you overlooked something in the documentation. From
perldoc perlref:
Only package variables are visible to symbolic references.
Lexical variables (declared with my()) aren't in a symbol
table, and thus are invisible to this mechanism.
So .. replace the my() with local() in your little program and all
will be fine.
May I also suggest against using symbolic references (use strict
forces you not to use them). Instead, you can create a hash of
variable names as keys, and their values as values.
my %hash = {
'work_item' => 1,
'request' => 2,
....
'status' => 3,
};
$field = 'work_item';
print "$field: $hash{$field}.\n";
>
> Thanks!
>
> Burton
You're Welcome.
> --------------------------------------------------
> #!/opt/x11r6/bin/perl
>
> #This is perl, version 5.004_04 built for sun4-solaris (etc.)
>
> my ($work_item_no, $request, $loc, $title, $impact,
> $considerations, $timestamp, $validate, $approval,
> $comment, $status)
> = split ',' , "1,2,3,4,5,6,7,8,9,10,11";
>
> for $field ( 'work_item_no', 'request', 'loc', 'title',
> 'impact', 'considerations', 'timestamp', 'validate',
> 'approval', 'comment', 'status') {
> $symbolic = "${$field}";
> print "$field: $symbolic\n";
> }
Ala
------------------------------
Date: Thu, 21 Jan 1999 13:56:42 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: dbmopen vs. tie
Message-Id: <MPG.11114275632a61fe989689@nntp1.ba.best.com>
In article <m37lui9e5y.fsf@joshua.panix.com>, jdf@pobox.com says...
> bluepuma@mailexcite.com writes:
>
> > If I would use the (not as easy to use) tie function, could I get
> > rid of the 1024 byte limitation of the value ?
>
> $ perldoc AnyDBM_File
>
> will lay out for you the dis/advantages of various uses of tie().
I wish it said more.
One advantage of using dbmopen for me is that I have DB_File on my
testing machine, and the system the program will run on when I'm done
testing has GDBM_File. Setting @AnyDBM_File::ISA to those two DBMs would
seem to make it a bit easier to move my script back and forth. That is,
I don't need to change use DB_File; to use GDBM_File; and using dbmopen
means I don't need to change a tie command when changing databases.
If dbmopen just calls tie, as AnyDBM_File indicates, then is there a way
to see how AnyDBM_File is actually calling tie?
Oh, another point I'm confused about. From reading DB_File pod it would
seem that if I want to install DB_File on the other system I'd need to
install not only the CPA module, but also Berkeley DB (page 387 blue
camel). Is there a way to tell if the Berkeley DB library is installed
on the system (the system happens to be at Berkeley, BMW). And if not
installed,
Thanks,
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Thu, 21 Jan 1999 16:17:54 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: dereference entire array of array references
Message-Id: <i29887.o7u.ln@magna.metronet.com>
Abraham Grief (abey@hill.ucr.edu) wrote:
: (@array1,@array2,@array3) = map {${$_}} @results;
: I haven't tried it, but I'm pretty sure that it should work.
This is comp.lang.perl.misc.
rec.humor.funny is somewhere else.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Jan 1999 16:12:26 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Difficult issues not suitable for this newsgroup?
Message-Id: <ao8887.o7u.ln@magna.metronet.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote:
: Randal, Usenet Cabal member # 02134
I guess # 90210 is already taken by a member of the
California local of the Cabal?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Jan 1999 23:22:53 GMT
From: birgitt@my-dejanews.com
Subject: Re: Difficult issues not suitable for this newsgroup?
Message-Id: <788cs1$fqi$1@nnrp1.dejanews.com>
In article <784mjo$m3g@romeo.logica.co.uk>,
"James Richardson" <richardsonja@logica.com> wrote:
>
> <BAD MOOD>
> Why oh why is it that only simple questions seem to be asked / answered on
> this newgroup?
[snip]
> What do you think?
[snip]
> But people should also be encouraged to think for themsleves before
> seeking help (aka ->result with others doing the work for them!)
>
>
And if one encourages as much as it is usually done here, you see
results. :-)
Difficult problems are all get solved by "themselves" these days.
For the remaining simple questions, complain at a higher level for
making and getting new(bab)ies (into clpm) daily. God must have had
a lot of fun setting us up this way. :-)
B.Funk
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 21 Jan 1999 15:50:33 -0800
From: Ben Gilbert <bgilbert@sgi.com>
Subject: Re: finding dirs with readdir
Message-Id: <36A7BD49.FC1554ED@sgi.com>
Ben Gilbert wrote:
> my $path = ".";
>
> opendir(DIR, $path) or die "couldn't open $path ($!)\n";
>
> my @img = grep { /\.jpg$/i || /\.gif$/i } readdir(DIR);
> rewinddir(DIR);
> my @dir = grep { -d } readdir(DIR);
>
> closedir (DIR);
>
> Any ideas?
My bobo -d checks on files (and dirs) in the *current* directory only.
Therefore I only was matching things found in both $path and the
directory where the script was executed. Note: my code above would work,
but not if I specified some other $path.
Better code would look like (faster, doesn't require multiple disk i/o's
and hey it works):
my $path = "/usr/people/www/";
opendir(DIR, $path) or die "couldn't open $path ($!)\n";
my @list = readdir(DIR);
closedir (DIR);
my @img = grep { /\.jpg$/i || /\.gif$/i } @list;
my @dir = grep { -d $path . $_ } @list;
print "imgs are: @img\n";
print "dirs are: @dir\n";
--
Ben Gilbert bgilbert@sgi.com 650.933.8721 (w) 888.502.3126 (p)
Technical Consultant, SGI http://reality.sgi.com/bgilbert/
-----------------------------------------------------------------
This transmogrifier will turn you into anything at all. - Calvin
-----------------------------------------------------------------
------------------------------
Date: Thu, 21 Jan 1999 13:43:02 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: handling STDERR in open()
Message-Id: <x3ypv88o4ay.fsf@tigre.matrox.com>
Andrew S Gianni <agianni@acsu.buffalo.edu> writes:
> I'm using open to access the output of a system call:
>
> open(SESAME, "system_call -foo |");
Please tell me that this is only an example, and that you check the
return value of your open().
>
> and the call kicks some stuff out the standard error which I want to
> capture and dump. However, I can't just do:
>
> open(SESAME, "system_call -foo |&");
Ahh .. once again, the FAQs come to the rescue. It just amazes me how
much information the FAQ authors were able to stuff into the FAQs.
Anyway, from perldoc perlipc:
And here's how to start up a child process you intend to
read from:
open(STATUS, "netstat -an 2>&1 |")
|| die "can't fork: $!";
while (<STATUS>) {
next if /^(tcp|udp)/;
print;
}
close STATUS || die "bad netstat: $! $?";
A complete example. How convenient. Anyway, the trick is with the
'2>&1' notation, which is really unix's way to redirect stderr into
the same stream as stdout.
Hope this helps,
Ala - the new FAQ consultant.
------------------------------
Date: Thu, 21 Jan 1999 14:26:08 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Help with RE for separate Perl codes and comments
Message-Id: <x3yognso2b5.fsf@tigre.matrox.com>
Jerry Chen <016781c@acadiau.ca> writes:
> I have some difficulties to parse Perl code to identify
> the source part and comment part using
> regular expression. From searching the Dejanews archive,
> I know that it is difficult to separate codes with comments.
Comments in Perl start with a '#' until the end of the line. There is
no other way for comments in Perl (except if you use pod constructs,
but those aren't "comments").
> However, I do not need to be 100% accurate. Something close
> will be ok.
I wonder why!!!
But anyway, the following should work ..
$script =~ s/\#.*\n//g;
> Any helps are appreciated.
> Thanks,
Since you don't exactly specify what, why and how you want to do this,
that's all I can do for you. Tell us some more if you need more
specific help.
Ala
------------------------------
Date: Fri, 22 Jan 1999 00:07:50 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <slrn7afgc4.5f.alastair@calliope.demon.co.uk>
Greg Ward <gward@cnri.reston.va.us> wrote:
>
>If you're thinking of distributing software with configuration or
>installation scripts written in Perl instead of shell, be *very very*
>careful. Some vendors do include Perl with their commercial Unix
>installations, but it might be old, very old, or creakingly ancient
>(like the OS itself).
Agreed for IRIX. Up until recently, perl 4 was the standard installation. A real
pain. The new release has perl 5 installed but these machines are a big minority
ofcourse. Later 'inst' dists can be found for IRIX at ;
http://reality.sgi.com/scotth_corp/info/perl5.html
Not the latest yet though.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: 22 Jan 1999 00:05:13 GMT
From: "sysadmin" <charlesjourdan@worldnet.att.net>
Subject: length($string) in UNIX environment
Message-Id: <788fbp$7m8@bgtnsc03.worldnet.att.net>
I want to count each character in a string which is a series of numbers
My debug output seems like there are 2 hidden chars
Are these [\n][NULL] ?
Notice how next to last position causes a newline
Not sure
Please see output
Thanks
Joe
54 joe /u/joe>cat infile
000000000000001001002002002002001000001000000000000
55 joe /u/joe>tfac5 infile
$len_szgrid = 52
sizegrid[i] = Position=52
sizegrid[i] =
Position=51
sizegrid[i] = 0 Position=50
sizegrid[i] = 0 Position=49
sizegrid[i] = 0 Position=48
sizegrid[i] = 0 Position=47
sizegrid[i] = 0 Position=46
sizegrid[i] = 0 Position=45
sizegrid[i] = 0 Position=44
sizegrid[i] = 0 Position=43
sizegrid[i] = 0 Position=42
sizegrid[i] = 0 Position=41
sizegrid[i] = 0 Position=40
sizegrid[i] = 0 Position=39
sizegrid[i] = 1 Position=38
sizegrid[i] = 0 Position=37
sizegrid[i] = 0 Position=36
sizegrid[i] = 0 Position=35
sizegrid[i] = 0 Position=34
sizegrid[i] = 0 Position=33
sizegrid[i] = 1 Position=32
sizegrid[i] = 0 Position=31
sizegrid[i] = 0 Position=30
sizegrid[i] = 2 Position=29
sizegrid[i] = 0 Position=28
sizegrid[i] = 0 Position=27
sizegrid[i] = 2 Position=26
sizegrid[i] = 0 Position=25
sizegrid[i] = 0 Position=24
sizegrid[i] = 2 Position=23
sizegrid[i] = 0 Position=22
sizegrid[i] = 0 Position=21
sizegrid[i] = 2 Position=20
sizegrid[i] = 0 Position=19
sizegrid[i] = 0 Position=18
sizegrid[i] = 1 Position=17
sizegrid[i] = 0 Position=16
sizegrid[i] = 0 Position=15
sizegrid[i] = 1 Position=14
sizegrid[i] = 0 Position=13
sizegrid[i] = 0 Position=12
sizegrid[i] = 0 Position=11
sizegrid[i] = 0 Position=10
sizegrid[i] = 0 Position=9
sizegrid[i] = 0 Position=8
sizegrid[i] = 0 Position=7
sizegrid[i] = 0 Position=6
sizegrid[i] = 0 Position=5
sizegrid[i] = 0 Position=4
sizegrid[i] = 0 Position=3
sizegrid[i] = 0 Position=2
sizegrid[i] = 0 Position=1
56 joe /u/joe>cat ./scripts/perl5/facomm_check.p
#!/usr/local/bin/perl -w
# faccom_check
# 99-01-20
# This is a re-do of the awk script
# Purpose:
# dump the transmit file and analyze content for quantities
# sizegrid array
while ($line = <>) {
# identify sizegrid
$sizegrid_str=$line;
# Convert sizegrid string into an array
$len_szgrid=(length($sizegrid_str));
print "\$len_szgrid = $len_szgrid\n";
#exit 0;
# *or `$i=1; $i<$len_szgrid
for ($i=$len_szgrid; $i>0; $i--) {
$sizegrid[$i]= (substr($sizegrid_str, $i, 1));
print "sizegrid[i] = $sizegrid[$i] Position=$i Sum=$sum\n";
}
}
--
===========================================
Opinions my own and not representative of my employer
Do not listen to me: I have brain damage
===========================================
------------------------------
Date: Thu, 21 Jan 1999 23:10:09 GMT
From: dhosek@webley.com
Subject: Re: list of hashes
Message-Id: <788c48$f0f$1@nnrp1.dejanews.com>
In article <7880e2$1mo$2@client2.news.psi.net>,
abigail@fnx.com wrote:
> dhosek@webley.com (dhosek@webley.com) wrote on MCMLXIX September MCMXCIII
> in <URL:news:787tha$1fr$1@nnrp1.dejanews.com>:
> :: In article <78548m$ejs$5@client2.news.psi.net>,
> :: abigail@fnx.com wrote:
> :: > Alex Farber (alex@kawo2.rwth-aachen.de) wrote on MCMLXVIII September
> :: > MCMXCIII in <URL:news:36A61CBA.E95076A7@kawo2.rwth-aachen.de>:
> :: > [] could you please explain it little bit more? Because you seem
> :: > [] to be correct - it looked like I was always pushing the same
> :: > [] (it printed HASH(0x80c5c9c) for all occurences) empty hash with
> :: > [] my SybPerl-script:
> :: > RTFM. It's documented.
> :: And the documentation is not at clear on how to handle this sort of thing.
> :: Have YOU read the documentation, Abigail?
> What's so unclear about:
> If $wantRef is non-0, then a reference to an array
> (or hash) is returned. This reference points to a
> static array (or hash), so to store the returned
> rows in an array you must copy the array (or hash):
> while($d = $dbh->ct_fetch(1, 1)) {
> push(@rows, {%$d});
> }
> It explains *exactly* the problem, it tells you how to solve it, and
> it includes even an example how to do it.
> What else do you need? Someone to actually do the cut-and-paste for you?
It would have been nice if the docs had mentioned that you can get an actual
array returned from ct_fetch and ct_sql rather than just a reference, or at
least had been clearer about that. The docs also failed to give an example of
the hash variant of ct_sql without a callback function. Given a bit more
experience with the Sybase::CTlib stuff, I will likely take the time to write
documentation which I hope will be easier for people who want to get up to
speed in a hurry. It's worth noting that I know a lot more about sybperl and
perl5 already now than I did when I posted the message that you're replying
to.
However, Michael Peppler is easily one of the most helpful package authors
around there. In my frequent dejanews searches for information about how to
handle problem X with sybperl, MP almost always is one of those providing an
answer to a query. I have yet to see him chastize a poster for failing to do a
dejanews search or read the documentation or be completely up to speed with
Perl5 features.
-dh
I'll readily admit that I'm just beginning to get up to speed on Perl 5
conventions, after years of being able to get by with Perl4 stuff. That was
part of the reason for the opacity of the documentation.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 21 Jan 1999 22:57:13 GMT
From: hbamford@marconi.ih.lucent.com (Harold Bamford)
Subject: Re: Looking for free Web Server with CGI
Message-Id: <788bc9$q94@ssbunews.ih.lucent.com>
In article <788aak$5hs$1@uranium.btinternet.com>,
Denny John <denny.john@btinternet.com> wrote:
>Have you tried the pws (personal web server) that comes with your win98 cd -
>theres a pws directory in the misc directory I think. Its seems to be pretty
>good.
I have installed PWS on my Win98 box. And I cannot figure out how to
get CGI running. Do the CGI scripts have to be in a particular
location? Do they need a particular suffix?
Can somebody give me a trivial, but working, example of using a perl
CGI script under PWS?
Thanks.
--
-- Harold Bamford
mailto:hbamford@lucent.com
(630)713-1351
------------------------------
Date: 21 Jan 1999 15:47:54 PST
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Looking for free Web Server with CGI
Message-Id: <788eba$6uo@journal.concentric.net>
hbamford@marconi.ih.lucent.com (Harold Bamford) writes:
>I have installed PWS on my Win98 box. And I cannot figure out how to
>get CGI running. Do the CGI scripts have to be in a particular
>location? Do they need a particular suffix?
>Can somebody give me a trivial, but working, example of using a perl
>CGI script under PWS?
This really does *not* belong in this group, but I'll go ahead and post
it anyway. Though I would rather be using a C64, at work I'm forced to use
a Win95 box. It runs PWS. You need ISAPI Perl for this.
To set up CGI, go to regedit and find this node:
\My Computer\HKEY_LOCAL_MACHINE\System\CurrentControlSet\ ...
Services\W3Svc\Parameters\Script Map
Inside that, add a key ".pl" with the path to your ISAPI Perl DLL as the
value (on my system it's "C:\Perl\bin\PerlIS.dll").
Your CGI scripts belong in the webshare\scripts directory (by default PWS
sticks everything under c:\WebShare). Add a .pl extension to them. All PWS
scripts are treated as if they were nph, so you need to add HTTP headers.
Here's a sample:
-- cut 8< --
print <<"EOF";
HTTP/1.0 200 OK
Content-Type: text/html
Mortimer ... we're back!
EOF
#
-- cut 8< --
This really does belong elsewhere, though. The microsoft.* hierarchy is
just stuffed with groups along these lines.
--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
-- supporting the Commodore 64/128: http://www.armory.com/~spectre/cwi/ --
head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"
------------------------------
Date: Thu, 21 Jan 1999 00:48:50 -0500
From: "Jim and Lois" <kf4dmb@camcomp.com>
Subject: newbie: looking for script to send a form to a printer ?
Message-Id: <36a7c7b2.0@camcomp2.camcomp.com>
I am trying to set up a trouble desk . users can fill out a form on our
intranet
and printer on a at our help desk . I have linux systems and windows NT
thanks
------------------------------
Date: Thu, 21 Jan 1999 22:56:44 GMT
From: cometsoft@yahoo.com
Subject: open() "bad file number" help!
Message-Id: <788bb6$ecu$1@nnrp1.dejanews.com>
I am having a problem with a Perl/CGI script. It returns a "Bad file number"
error.
the only pertinent lines of code I _believe_ are :
$filename = "../incoming/junk.dat";
$file_contents = "this is some stuff for the file...";
open (F, $filename);
print F $file_contents;
close (F);
Thanks
Craig
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 21 Jan 1999 23:10:18 GMT
From: no.richro.spam@acm.org (Richard Rowell)
Subject: Re: Pattern match behaves strangely
Message-Id: <36a7b335.191010248@news.shreve.net>
Duh! Thanx, I often find I need someone else to point out the obvious
for me.... I remember once I had a C program acting strangely, and I
couldn't understand why. Days later i found this:
for (int x=0;x<8;x++);
{
...
}
That little ; at the end of the for caused me endless aggravation. On
the upside, I always look for the stray ; first now....
Thanx again!
On Thu, 21 Jan 1999 16:34:16 -0500, fl_aggie@thepentagon.com (I R A
Aggie) wrote:
>In article <36a77505.175090106@news.shreve.net>, no.richro.spam@acm.org
>(Richard Rowell) wrote:
>
>+ This prints YUP for some reason. I thought that \s* would only match
>+ spaces, \t,\n,\r, and \f (whatever \r, and \f are).
>
>Well, not entirely. The '*' means 'match 0 or more times'. Well, how many
>times is \s* going to match? every time, since it should match 0 occurances.
>
>What you want (I think) is \s+, or perhaps \s+?
>
>James
------------------------------
Date: Thu, 21 Jan 1999 16:04:56 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: pattern matching (details)
Message-Id: <8a8887.o7u.ln@magna.metronet.com>
Xavier Cousin (cousin@ensam.inra.fr) wrote:
: Hello i send earlier the following message but it appears some details
: are needed.
Like a description of what you want?
I don't see where you tell us that.
I can see that it has something to do with removing duplicates,
but I don't know where you want the uniqified thingies.
Put them in an array? A hash? Print them out?
In any case, I'm sure you checked the Perl FAQ before posting,
as a good Network Citizen would do, so I guess you need
something different than what is given in the FAQ?
Perl FAQ, part 4:
"How can I extract just the unique elements of an array?"
What do you need that you don't get from the several solutions
offered there?
: open (MUTSUB,tkkkout) or print "cant open tkkkout";
: while (<MUTSUB>){
: ($mutation,$reste) = split / /,$_,2;
: if ($kksub{$mutation} !~ /$reste/){
Do you have regex metacharacters in $reste?
If so, you may want to escape them:
if ($kksub{$mutation} !~ /\Q$reste/){
: $kksub{$mutation} .= $reste;
: }
: }
: bunfa-acche_M70Y+K285D description
: bunfa-acche_M70Y+K285D other_description
: bunfa-acche_M70Y+K285D description
: I want only one element of each kind :
: bunfa-acche_M70Y+K285D description
: bunfa-acche_M70Y+K285D other_description
: What i don't understand is that using the above scripts i i don't
: suppress doublets, i have :
^^^^^^
^^^^^^
Where do you have that?
None of your data structures have that.
Your program produces no output.
When I print out the %kksub hash, it has one element with the
key 'bunfa-acche_M70Y+K285D' and the
value "description\nother_description"
If that is what you want, then you don't seem to have a problem
as the duplicate is not there...??
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Jan 1999 23:59:13 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: pattern matching (details)
Message-Id: <slrn7affrv.5f.alastair@calliope.demon.co.uk>
Xavier Cousin <cousin@ensam.inra.fr> wrote:
>Hello i send earlier the following message but it appears some details
>are needed.
SNIP
>
>open (MUTSUB,tkkkout) or print "cant open tkkkout";
Doesn't that line mean you continue the program if the open fails?
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Thu, 21 Jan 1999 13:27:17 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: pattern matching trouble
Message-Id: <x3yr9soo518.fsf@tigre.matrox.com>
Xavier Cousin <cousin@ensam.inra.fr> writes:
> Hello, i've got a pattern matching trouble in a perl script, here is an
> piece of the code dealing with the pattern matching :
>
> open (MUTSUB,tkkkout) or print "cant open tkkkout";
I figure that you're not using '-w' or you would've gotten a warning
on the line above for the bareword. Use -w .. always.
open MUTSUB, "tkkkout" or print "Can't open tkkkout";
BTW, if the open fails, you will get your message printed, but the
program will go on to read from MUTSUB, which would be just a loose
filehandle .. no good. But this is another issue.
> while (<MUTSUB>){
> ($mutation,$reste) = split / /,$_,2;
> if ($kksub{$mutation} !~ /$reste/){
> $kksub{$mutation} .= $reste;
> }
> }
>
> here is an example of data found in 'tkkkout' file :
> bunfa-acche_M70Y+K285D
> <TR><TH><PRE>Acetylthiocholine</TH><TD><PRE>95.3 & 5.9 uM</TD><TD><PRE>-</TD><TD><PRE>
> T25C IS 50 mM phosphate</TD><TD><PRE><A
> href=/chol.cgi-bin/webace?db=achedb&class=Paper&object=
> Cousin_1996_J.Biol.Chem_271_15099>
> Cousin_1996_J.Biol.Chem_271_15099</A></TD></TR>
>
> They are one line elements which can be repeted several times in the
> file (this why i try to exclude doublets).
you try to exclude "doublets"? what are doublets? and how are you
trying to exclude them? I don't see that in the code.
> I don't know how solve this problem. Thanks for your help.
What is your problem? I don't see any questions here.
Could you rephrase your question please?
> Xavier
Ala
------------------------------
Date: Thu, 21 Jan 1999 22:56:24 GMT
From: kamez@my-dejanews.com
Subject: Re: perl script error
Message-Id: <788bah$eck$1@nnrp1.dejanews.com>
Hi Jurgen,
actually i use "$ARGV[1]" , but my problem is the following :
open(IN,"<$name" ) or die "can't open file: $!\n";
this previous line , causes this error message :
"bash: syntax error near unexpected token `open(IN,"<$name"' "
actually i don't know perl at all , it's just the first time..So thanks
a lot for your help..
Khalid.
In article <786jhk$7m4$2@penthesilea.Materna.DE>,
Juergen.Puenter@materna.de (J|rgen P|nter) wrote:
> In article <784t8v$c6g$1@nnrp1.dejanews.com>, kamez@my-dejanews.com says...
>
> Dear Khalid,
>
> >$name = $ARGV[$1];
>
> is this a typo or do you really mean $ARGV[$1]?
>
> If you want to access ARGV, it should be $ARGV[1].
> $1 is a backreference from a pattern match, which
> you probably don't want here.
>
> HTH
> Juergen Puenter
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 00:11:00 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: perl script error
Message-Id: <slrn7afgi2.5f.alastair@calliope.demon.co.uk>
kamez@my-dejanews.com <kamez@my-dejanews.com> wrote:
>thanks for helping me for the following touble i have ,
>i'm not used with Perl ,
>Thanks for any quick advise.
>Khalid,
SNIP
>
>$ more scriPerl.pl
>$start;
>$max_kbps=256;
..
If you're going to run it as './script.pl' then where's the first line?
#!/usr/bin/perl
$start;
$max_kbps=256;
(change to where your perl is : try 'which perl').
HTH.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: 22 Jan 1999 00:31:36 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: PERL Security Issues
Message-Id: <788gt8$s0f$2@news0-alterdial.uu.net>
Nick Smith <nick.smith@team.xtra.co.nz> wrote:
> I am preparing a document that relates to the security issues
> pertaining to hosting PERL enabled websites on a webserver. Could any
> of you either email me or point me to a reference that contains an
> exhaustive guide re: PERL Scripting Security issues?
"man perlsec" is a good starting point. Poke around www.perl.com -- Tom
C. has put up a bunch of FAQs related to Perl web programming, and
security is mentioned in some of them. Also many general Web
security/programming FAQs say something about Perl, because it's so
widely used for Web programming. I don't know of any single document
that spells it all out though.
But "man perlsec" gives you the technical nitty-gritty. Start there.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Thu, 21 Jan 1999 00:13:37 -0200
From: "Roberto" <roberto@iee.efei.br>
Subject: Problems whit Perl and NT Option Pack
Message-Id: <7862cc$inl$1@gerson.iee.efei.br>
When I try to execute a cgi, I recive this menssage:
"CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't open perl script "$$": No such file or directory"
Thank's.
------------------------------
Date: 21 Jan 1999 16:51:40 PST
From: Cameron Kaiser <cdkaiser@delete.these.four.words.concentric.net>
Subject: Re: Problems whit Perl and NT Option Pack
Message-Id: <788i2s$amr@journal.concentric.net>
"Roberto" <roberto@iee.efei.br> writes:
>When I try to execute a cgi, I recive this menssage:
>"CGI Error
>The specified CGI application misbehaved by not returning a complete set of
>HTTP headers. The headers it did return are:
>Can't open perl script "$$": No such file or directory"
Then that would be a problem with the web server, would it not?
--
Cameron Kaiser * cdkaiser.cris@com * powered by eight bits * operating on faith
-- supporting the Commodore 64/128: http://www.armory.com/~spectre/cwi/ --
head moderator comp.binaries.cbm * cbm special forces unit $ea31 (tincsf)
personal page http://calvin.ptloma.edu/~spectre/ * "when in doubt, take a pawn"
------------------------------
Date: Thu, 21 Jan 1999 19:54:56 -0500
From: "Brian Thompson" <hitbyabus@mindspring.com>
Subject: Random Invoice #
Message-Id: <788icg$i0l$1@camel18.mindspring.com>
Is there anyway that I can assign a random number to a scalar? I'm using it
for invoice numbers....I want it to begin with 00000000 and then goto
00000001 and so on, everytime the form is submitted
------------------------------
Date: Fri, 22 Jan 1999 00:35:37 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Regex challenge
Message-Id: <36A7C993.6A231995@home.com>
[posted & mailed]
Dean Inada wrote:
>
> s/(table)/'chair' ^ lc($1) ^ $1/ie;
It took me a bit to figure this out until I remembered that lower case
ascii letters are the same as upper case, but with an extra bit set.
This is very nice. The best solution by far IMHO.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 22 Jan 1999 00:25:58 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Running -T
Message-Id: <788gim$s0f$1@news0-alterdial.uu.net>
R. Alcazar <alcazar@netcomp.net> wrote:
> How come I get this error when include -T such:
>
> #!/usr/bin/local/perl -T
>
>
> Too late for "-T" option at somefile.cgi line 1
Any time you get a confusing error message from Perl, consult the
'perldiag' man page. Had you done so, you would have learned the
following:
Too late for "-T" option
(X) The #! line (or local equivalent) in a Perl script
contains the -T option, but Perl was not invoked with -T
in its command line. This is an error because, by the
time Perl discovers a -T in a script, it's too late to
properly taint everything from the environment. So Perl
gives up.
If the Perl script is being executed as a command using
the #! mechanism (or its local equivalent), this error
can usually be fixed by editing the #! line so that the
-T option is a part of Perl's first argument: e.g.
change perl -n -T to perl -T -n.
If the Perl script is being executed as perl scriptname,
then the -T option must appear on the command line: perl
-T scriptname.
I think that explains things adequately!
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Thu, 21 Jan 1999 21:56:50 GMT
From: mlvanbie@hopper.math.uwaterloo.ca (Michael Van Biesbrouck)
Subject: Re: Secuity hole with perl (suidperl) and nosuid mounts on Linux
Message-Id: <F5xJMq.39v@undergrad.math.uwaterloo.ca>
In article <780m68$o9i$1@nemesis.niar.twsu.edu>,
Peter Samuelson <psamuels@sampo.creighton.edu> wrote:
>Let it be noted that allowing physical access to an important machine
>is asking for trouble already, and allowing users to do things like
>mount floppies and cdroms is maybe even a little more careless, so a
>truly paranoid admin wouldn't have been hit by this bug anyway.
Physical access is not required. Some systems (Ultrix, I recall) may
allow NFS-mounting of filesystems with secure options. Unfortunately,
suidperl will allow this to be circumvented.
Linux has the capabilities for secure SUID scripts, if someone
implements the details. This will not prevent suidperl from causing
problems on many supported legacy systems, however.
Reading the mounting information for the filesystem is not portable,
but there will be no race conditions for some types of filesystems.
Once the filesystem is opened, the filesystem (usually) cannot be
unmounted and is easily identified by the device number in the fstat
information.
Some network filesystems can be mounted and unmounted even though
a file is open, but this might be okay. Is there a danger from the
user managing to mount a new filesystem with the same device number but
friendlier mounting permissions? I think that would suggest that there
is a different security hole, but if there was a list of acceptable file
systems for mounting with SUID permission, then there is an exploitable
race condition.
--
(*Michael Van Biesbrouck/UW CS Grad Student/MultiText RA*) r([k,X,_|T],[X|T]).
r([s,F,G,X|T],[F,X,[G,X]|T]). r([L|T],S):-a(L,[],R),a(R,T,S). r(X,Y):-v(X,Y).
v([X|T],[Y|T]):-r(X,Y). v([[X]|T],[X|T]). v([X|T],[X|U]):-v(T,U). a([],L,L).
a([X|T],L,[X|S]):-a(T,L,S). n(X,Z):-r(X,Y),!,n(Y,Z). n(X,X):-not r(X,_).
------------------------------
Date: Thu, 21 Jan 1999 18:02:53 -0600
From: "Matt Johnson" <cpuweb@cpuweb.com>
Subject: Trying to match a variable with another variable.
Message-Id: <788fb6$6pq$1@news.ipa.net>
This is the code I have so far:
if ($fields{'sort1'} eq $fieldname1 or $fieldname2 or $fieldname3 or
$fieldname4 or $more) {
# Do somehting.
}
What I want to do is find out which one of them it matched and be able to
asign it to a variable, instead of making an if statement for each one. I
know there is a way to do it but can't seem to find it.
------------------------------
Date: Thu, 21 Jan 1999 14:36:08 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
To: emm@cam.org
Subject: Re: Ubiquitous Script
Message-Id: <x3yn23co1ug.fsf@tigre.matrox.com>
[posted and mailed to the good address]
validAddress@at.TheEndOfMessage (Emmanuel M. Dicarie) writes:
> My questions are :
>
> 1) Is there a way to call a scrip from anywhere without specifying where
> the script reside?
That isn't really Perl. You need to read more on unix. I suggest you
create a subdirectory to store all your scripts. I call mine
bin/. /util is another popular choice. Then you must add this
directory to your $PATH environment variable.
> 2) Also, instead of giving as parameter to my script a whole path to the
> directory where I want to process the files, is it possible to do
> something like
> processFiles pwd ?
One way is to alter your script. But I suspect that you don't wanna do
that. But in case you do, I would let it use the current directory if
no arguments where passed to it.
Another way would be:
processFiles `pwd`
Note: pwd is surrounded by backticks `` not single quotes ''.
again, you need to read some more about the unix environment.
> TIA
>
> -Emmanuel
Hope this helps,
Ala
------------------------------
Date: Thu, 21 Jan 1999 16:39:31 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Y2K?
Message-Id: <3ba887.o7u.ln@magna.metronet.com>
[ the alt. hierarchy is a wasteland. Newsgroups and Followups trimmed ]
Tuomas Angervuori (tumppi@icon.fi) wrote:
: I have a script which compares two dates.
: -Clip-
: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
: localtime(time);
: #if current date is newer than the one mared in data files, update...
: if (($year == $year_data) and ($mon >= $mon_data)) {
: if ($mday > $mday_data) {
: &update;
: }
: }
: if ($year > $year_data) {
: &update;
: }
: -Clip-
: $year_data, etc, are found from the data files.
Were they also from calls to localtime()?
If so, then no problem...
If not, then we need to know what format they are in if
you want us to evaluate how well comparing to them will work...
: As you might have noticed, this isn't year 2000 compatible.
Yes it is.
Where do you see a problem?
: The
: question is, how can I make year 2000 compatible date comparisition?
The way you have it is how you make a year 2000 compatible
date comparison.
: I'm sure there is a much better way to do this but this was all I
: managed to do with my current programming skills.
I think it is your current reading skills that are the
limiting factor ;-)
Look up localtime() in 'perlfunc.pod' again and read what is
says about the year more carefully...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Jan 1999 13:19:36 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Yet another basic question.
Message-Id: <x3ysod4o5dz.fsf@tigre.matrox.com>
"Ban Spam Now" <no_spam@no_spam.com> writes:
>
> Is there any way to run an external ksh script, store the output in one Perl
> variable and the return code in another Perl variable. Does Perl work in
> such a way that the return code you get back will be the same as $? ?
Well, you should've read perlvar before you posted.
>From perlvar:
$? The status returned by the last pipe close, backtick
(``) command, or system() operator. Note that this
is the status word returned by the wait() system
call (or else is made up to look like it). Thus,
the exit value of the subprocess is actually ($? >>
8), and $? & 255 gives which signal, if any, the
process died from, and whether there was a core
dump. (Mnemonic: similar to sh and ksh.)
so ... to run your script from Perl, you would do something like:
$output = `script.sh`;
# $output has the output of your script
# $? will have it's exit status as mentioned above.
HTH,
Ala
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4715
**************************************