[13631] in Perl-Users-Digest
Perl-Users Digest, Issue: 1041 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 11 15:05:38 1999
Date: Mon, 11 Oct 1999 12:05:15 -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: <939668714-v9-i1041@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 11 Oct 1999 Volume: 9 Number: 1041
Today's topics:
Re: Call a C function (Abigail)
Re: Call a C function <laurensmith@sprynet.com>
Re: calling a dll from perl <bdkruse@NULLSTRINGimation.com>
Re: calling a dll from perl (Scott McMahan)
Re: Case Question. (Abigail)
Re: Case Question. (Craig Berry)
CGI.pm: Setting `Type' for stylesheets - How? <jerryp.usenet@connected.demon.co.uk>
Re: character count (Larry Rosler)
Re: Debugger and "O LineInfo=..." (Ilya Zakharevich)
Re: digit grouping function (Abigail)
Re: Do you now an affordable Perl editor for Windows NT (David H. Adler)
Re: downloading and comparing all bookmarks out of a bo (Abigail)
Re: Expansion (Abigail)
Re: Hash size limit ? (longish) (M.J.T. Guy)
Re: Hash size limit ? (longish) (Ilya Zakharevich)
Re: I need some Perl help (Bart Lateur)
Modifying subroutine arguments rwentwor@advent.com
Re: newbie question about quotes in code <woodwort@utmc.utc.com>
Re: parenthesizing arguments to grep - BLOCK form (Larry Rosler)
Re: Passing unknown filenames as arguments to another p (Abigail)
Perl lite <kristian@netscape.com>
Re: Question: How do I get the length of a string in PE (Abigail)
Re: Readding {boolean,int,float,longs,strings} from a f (Larry Rosler)
Re: Reference of instance method (M.J.T. Guy)
Re: Sequential Debugging ? - Problems (M.J.T. Guy)
Re: Shell and Perl have different $? (Ilya Zakharevich)
Re: solution: howto load modules to an ISP website? <flavell@mail.cern.ch>
Re: Sort one array by contents of another (Abigail)
Re: We do complex Perl Programming <keithmur@mindspring.com>
Re: Why's 'mailx' complaining? <flavell@mail.cern.ch>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Oct 1999 13:24:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Call a C function
Message-Id: <slrn804apo.gep.abigail@alexandra.delanet.com>
Vu N Dang (vdang@osf1.gmu.edu) wrote on MMCCXXXII September MCMXCIII in
<URL:news:7tsnuq$nb4@portal.gmu.edu>:
\\ Should I call a C function from a Perl program?
Maybe.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 11:32:27 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Call a C function
Message-Id: <7ttafs$d48$1@brokaw.wa.com>
Vu N Dang wrote in message <7tsnuq$nb4@portal.gmu.edu>...
>Should I call a C function from a Perl program?
That's about as ambiguous and philosophical as questions get, I suppose.
Try reading perldoc3 "Where can I learn about linking C with Perl?" it
will give you the pointers to what you may be looking for.
Selah.
Lauren
--
Do or do not, there is no try.
------------------------------
Date: Mon, 11 Oct 1999 13:19:27 -0500
From: "Brian Kruse" <bdkruse@NULLSTRINGimation.com>
Subject: Re: calling a dll from perl
Message-Id: <s04ah285h1s47@corp.supernews.com>
<tlars@my-deja.com> wrote in message news:7tssbr$ssd$1@nnrp1.deja.com...
> I looked at Win32::API. None of the functions seem designed to call a
> Dll. Which functions in Win32::API would you use to call a dll? Could
> you give me an example.
>
If you have the DLL source code, you may want to use SWIG to make a perl
module that calls the functions.
see www.swig.org for more info. Also, if you install, make sure you get the
latest maitnenance release instead of the 1.1p5 release.
-Brian
------------------------------
Date: Mon, 11 Oct 1999 18:47:08 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: calling a dll from perl
Message-Id: <MgqM3.1741$tL2.101536@newshog.newsread.com>
tlars@my-deja.com wrote:
> Does anyone know if it's possible to call a dll in the Win32 version of
> perl?
I don't think so directly. You could write a COM component that would
act as a passthrough (if you couldn't recompile the DLL as a
COM component itself).
Some information on this is in my book Automating Windows With Perl. At
least how to make a COM component Perl can call. You'll have to do the
rest yourself.
Scott
http://autoperl.skwc.com Automating Windows With Perl
------------------------------
Date: 11 Oct 1999 13:33:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Case Question.
Message-Id: <slrn804bal.gep.abigail@alexandra.delanet.com>
Kevin McCluskey (kevinm@papillonres.com) wrote on MMCCXXXII September
MCMXCIII in <URL:news:3802153A.B42F440@papillonres.com>:
|| I am trying to check a variable against an array of keywords and cannot
|| get it to ignore the case.
|| This is what I have:
||
|| $kw_len = @keywords;
||
|| sub keytest {
|| for($i=0;$i<$kw_len;$i++)
|| {
|| if ($word eq $keywords[$i]){
|| return 1;}
|| }
|| }
A few points. 1) Use proper indentation. Your code is hard to read.
2) Perl isn't C. Use Perl style loops. 3) Don't use global variables;
use parameters to your sub.
|| If I do: $word eq /$keywords[$i]/i
|| I don't get a compare.
Indeed. You would match $keywords[$i] against $_, and compare the result
of that with $word.
|| Any ideas ? is it that the "eq" operator does not work right with /i ?
Indeed. /i works on regexes.
The answer is of course to set both operands to the same case.
sub keytest ($@) {
my $word = lc shift;
foreach (@_) {return 1 if $word eq lc}
}
my $match = keytest $word => @keywords;
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 18:49:57 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Case Question.
Message-Id: <s04calhch1s56@corp.supernews.com>
Kevin McCluskey (kevinm@papillonres.com) wrote:
: I am trying to check a variable against an array of keywords and cannot
: get it to ignore the case.
: This is what I have:
:
: $kw_len = @keywords;
:
: sub keytest {
: for($i=0;$i<$kw_len;$i++)
: {
: if ($word eq $keywords[$i]){
: return 1;}
: }
: }
:
: If I do: $word eq /$keywords[$i]/i
: I don't get a compare.
Why should you? Change that eq to =~ and you might fare better.
But what you really want is called normalization. Force each side of the
comparison to lowercase and compare the results.
As a favor, here's your keytest sub, recoded in this and other ways to be
more 'perlish'. Note that kw_len is no longer required. Note also that
I've set it up to receive the search target and the list to search as
arguments, which is generally prefered to using globals. I've embedded
the new function in a small test program which demonstrates its use.
By the way, if you can control the list of keywords, you can store them in
normalized form (all lowercase) and thus omit the lc-ing done in the grep
block.
#!/usr/bin/perl -w
# keytest - find a key in a list, case-insensitive.
# Craig Berry (19991011)
use strict;
my @keys = qw(blah bleah foo quux boo nah);
print 'zap a keyword? ', (keytest('zap', @keys) ? 'Yes' : 'No'), "\n";
print 'fOo a keyword? ', (keytest('fOo', @keys) ? 'Yes' : 'No'), "\n";
sub keytest {
my ($word, @keywords) = @_;
$word = lc $word; # Normalize $word for comparisons
return scalar grep { $word eq lc } @keywords;
}
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "There it is; take it." - William Mulholland
------------------------------
Date: Mon, 11 Oct 1999 19:32:38 +0100
From: Jerry Pank <jerryp.usenet@connected.demon.co.uk>
Subject: CGI.pm: Setting `Type' for stylesheets - How?
Message-Id: <PNOy1CAG1iA4EwZX@btinternet.com>
Using CGI.pm, could someone kindly modify my example below, to output:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Stylish Docs</TITLE>
<STYLE TYPE="text/css"><!--
a:{color:{#000000}....
#!/bin/perl5 -w
use CGI qw(:all);
print header,
start_html(-TITLE => 'Stylish Docs',
-STYLE => "<!--\na:{color:{#000000}
a:vlink{color:#2222FF}
a:hover{color:#FF0000}-->\n"),
h1("It's the way you wear it...\n"),
a({-HREF => 'Foo.htm'}, 'Only Me!'),".\n",
end_html;
-- Jerry Pank:wq http://www.jp1.co.uk/
me@jp1.co.uk
I think that's way cool.
-- Larry Wall in <199709292015.NAA09627@wall.org>
------------------------------
Date: Mon, 11 Oct 1999 11:45:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: character count
Message-Id: <MPG.126bd02d6b0cfcb598a071@nntp.hpl.hp.com>
In article <38019FD4.BE77DE83@argogroup.com> on Mon, 11 Oct 1999
09:29:08 +0100, Jason P Tribbeck <jtribbeck@argogroup.com> says...
> hakanogren@my-deja.com wrote:
> > I need help to count the number of times a certain letter appears in a
> > string.
> > For example if a have a string "HELLO WORLD" i want to know how many
> > L's there are in the string.
>
> You could do the following:
>
> my $count=0;
> while($string=~m:L:g) {
> $count++;
> }
>
> print "There are $count 'L's in '$string'\n";
>
> Or:
>
> my $count=$string=~s:L:L:g;
>
> However, I've never done any speed tests to see which is faster. The
> first one is, in theory, slower, because there's more intepretation of
> the code, but the second does write back to the original string. Also,
> the latter may not be as understandable.
It would be nice to be rid of this problem once and for all, but I'm
afraid that's not going to happen. I include as 'A' and 'T' the
approaches suggested posted by Abigail in another followup to this
thread.
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
my $x = 'HELLO WORLD';
timethese(1 << (shift || 0), {
A => sub { my $count = () = $x =~ /L/g },
N => sub { my $count = 0; ++$count while $x =~ /L/g; $count },
S => sub { $x =~ s/L/L/g },
T => sub { $x =~ tr/L// },
});
__END__
Benchmark: timing 262144 iterations of A, N, S, T...
A: 9 wallclock secs ( 9.78 usr + 0.00 sys = 9.78 CPU)
N: 5 wallclock secs ( 5.45 usr + 0.00 sys = 5.45 CPU)
S: 5 wallclock secs ( 5.48 usr + 0.00 sys = 5.48 CPU)
T: 1 wallclock secs ( 1.64 usr + 0.00 sys = 1.64 CPU)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 11 Oct 1999 18:33:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger and "O LineInfo=..."
Message-Id: <7ttaim$6ti$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Chris Fedde
<cfedde@fedde.littleton.co.us>],
who wrote in article <YHoM3.80$F3.135467008@news.frii.net>:
> >This behaviour probably may be changed by an assignment to
> >$DB::emacs. Make an alias if you need to do this often.
> >
> >Do people want to have the style of the output settable from `O'?
> The manual page says:
>
> LineInfo File or pipe to print line number
> info to. If it is a pipe (say,
> |visual_perl_db), then a short,
> "emacs like" message is used.
>
> Specifically it does not mention that there is a difference between
> the behavior when set interactively vs when set out of PERLDB_OPTS.
I know. This is *your* discovery. ;-) As a discoverer, it is your
prerogative to document it.
> I don't know about "people" in general, but I'd like a way to insure
> that when LineInfo goes to a pipe, the pipe always gets the same
> data. I need to check the output for invisible characters. The
> thought that this might occur did not cross my mind. If this is
> indeed the case then it amounts to a third format.
??? Third?
I still did not see any constructive proposal.
Ilya
------------------------------
Date: 11 Oct 1999 13:35:03 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: digit grouping function
Message-Id: <slrn804beb.gep.abigail@alexandra.delanet.com>
Igor Vinokurov (igor@rtsnet.ru) wrote on MMCCXXXII September MCMXCIII in
<URL:news:3801d9f0@news.rtsnet.ru>:
//
// I would like if anyone advise digit grouping function, which
// can do following translation:
//
// 123456789 -> 123,456,789
RTFFAQ.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 11 Oct 1999 14:46:10 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <slrn804c3i.h1c.dha@panix.com>
On Thu, 7 Oct 1999 11:28:57 +0200, Matt King <mattking@techie.com>
wrote:
>Why not just use the Windows notepad.exe? Works fine for me......
Even better, why not just check the perl reference page for its entry
on editors
<http://www.perl.com/reference/query.cgi?section=editors&x=13&y=14> or
check a usenet archive for the answers provided the last 8000 times
this question came up?
HTH.
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Perhaps it IS a good day to Die! I say we ship it!
- a selection from "If Klingons developed software"
------------------------------
Date: 11 Oct 1999 13:36:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: downloading and comparing all bookmarks out of a bookmark file
Message-Id: <slrn804bg8.gep.abigail@alexandra.delanet.com>
Stefan Goerres (stefan.goerres@xsc.net) wrote on MMCCXXXII September
MCMXCIII in <URL:news:7tsk0e$amv$1@fu-berlin.de>:
$$ Well ... I want to write a script that is downloading all my bookmarked
$$ pages and automatically checks if they changed. Is that possible .. normally
$$ I'm not a perl programmer... so have you some handy ideas for me as a perl
$$ beginner? Is there maybe someone out there who tried thator maybe is having
$$ a ready to take script?
I'd suggest you either first learn Perl, or use a language you are more
famaliar with.
Abigail
--
perl -wlpe '}{*_=*.}{' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 11 Oct 1999 13:40:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Expansion
Message-Id: <slrn804bnu.gep.abigail@alexandra.delanet.com>
Matthew Walker (dmwalker@verio.net) wrote on MMCCXXXII September MCMXCIII
in <URL:news:3801FE49.9B7E0509@verio.net>:
'' Just need a little help. I can't find any documentation on my problem.
'' I am trying to expand on an existing program. There are some files on
'' this unix system that begin with a "-" minus character. As you know
'' Unix has a great deal of trouble doing anything with these files.
No, I don't. Tell me more about it.
'' I need to adapt the second block of code inside the foreach loop to move
'' these files to an error directory. Here is the program code...
''
You mean the:
'' # cheat and call unix 'mv' for now
'' return 1 unless system "mv $src $dst";
Well, either you don't "cheat", or you ask in a group where they
discuss Unix file utilities.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 11 Oct 1999 18:14:20 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Hash size limit ? (longish)
Message-Id: <7tt9ds$a32$1@pegasus.csx.cam.ac.uk>
Csaba Raduly <csaba.raduly@sophos.com> wrote:
>
>Read and laugh: here's the mysterious line 1762
> 'm:\path...\scotts.co', 'Scott's Valley',
Heeheehee!
>That single quote wasn't very nice :-(
>What I don't understand now is why there was no error message.
>After all, from now on everything is a mess syntactically,
>barewords, missing commas and the like.
Well, it isn't *that* much of a mess. You've got a string 'Scott'
followed by a substitution using the delimiter 'V'. So further
antics'll depend on where the subsequent 'V's are in the document.
And remember that abcd'efgh is a valid Perl bareword (perl4 compatibility).
But I'm still surprised you got no error at all. I'd be interested
in seeing your complete data file. (Mail it to me - I assume the
rest of the newsgroup will be happy enough without it.)
Mike Guy
------------------------------
Date: 11 Oct 1999 18:25:41 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Hash size limit ? (longish)
Message-Id: <7tta35$6qq$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to M.J.T. Guy
<mjtg@cus.cam.ac.uk>],
who wrote in article <7tt9ds$a32$1@pegasus.csx.cam.ac.uk>:
> > 'm:\path...\scotts.co', 'Scott's Valley',
>
> Heeheehee!
>
> >That single quote wasn't very nice :-(
> >What I don't understand now is why there was no error message.
> >After all, from now on everything is a mess syntactically,
> >barewords, missing commas and the like.
>
> Well, it isn't *that* much of a mess. You've got a string 'Scott'
> followed by a substitution using the delimiter 'V'. So further
> antics'll depend on where the subsequent 'V's are in the document.
> And remember that abcd'efgh is a valid Perl bareword (perl4 compatibility).
>
> But I'm still surprised you got no error at all. I'd be interested
> in seeing your complete data file. (Mail it to me - I assume the
> rest of the newsgroup will be happy enough without it.)
To see (a pretty good guess of) how Perl parses your stuff, load CPerl
and enable "hairy".
Ilya
------------------------------
Date: Mon, 11 Oct 1999 18:35:10 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: I need some Perl help
Message-Id: <38022c07.251886@news.skynet.be>
Abigail wrote:
>Oh gosh, don't tell me Perl is making needless copies. It shouldn't
>do that.
Shouldn't it?
$_ = "abc";
$hash{$_} = 123;
substr($_,1,1) = "X";
print "$_:$hash{$_}:$hash{abc}\n";
-->
Use of uninitialized value at test.pl line 4.
aXc::123
The "uninitalized value" is of course the hash value for the new $_.
Now, I *must* have two copies of the string "abc", and only one of them
($_) is changed to "aXc". The hash key itself is not affected. Good.
BTW I have read somewhere that if hashes share some hash keys, then
those hash keys are shared between the hashes.
--
Bart.
------------------------------
Date: Mon, 11 Oct 1999 18:02:50 GMT
From: rwentwor@advent.com
Subject: Modifying subroutine arguments
Message-Id: <7tt8o1$6rn$1@nnrp1.deja.com>
I was having problems posting this. I appoligize if it appears more
than once.
I've tried getting an answer from the various man pages but nothing
worked properly. I also did a search through the old newsgroup postings
without any luck. Perhaps I'm missing something obvious?
I'm trying to pass two variables to a subroutine and modify the values.
Here's the subroutine:
sub GetCheckoutInfo {
my $Filename = shift;
local *User = \$_[0];
local *Dir = \$_[1];
my $Line;
open STATUS, "<$Filename";
$Line = <STATUS>;
close STATUS;
chomp $Line;
$User = substr($Line,20,8);
$Dir = substr($Line, 56);
}
This is called in this fashion:
GetCheckoutInfo("status.lst", $Username, $Path);
The file being read will contain a single line (the output from
SourceSafe), similar to this:
"A1842.REP Admin Exc 10/07/99 10:07a C:\cus"
I'm attempting to extract the checkout name (Admin) and the checkout
path (c:\cus) and return these values.
The above subroutine works as long as I DON'T include "use strict;".
Perl kicks out:
Variable "$User" is not imported at test.pl line 14.
Global symbol "$User" requires explicit package name at test.pl line 14.
Variable "$Dir" is not imported at test.pl line 15.
Global symbol "$Dir" requires explicit package name at test.pl line 15.
test.pl had compilation errors.
I prefer to keep the extra safeties turned on. I was finally able to
get it working by deleting the two "local" lines and replacing the last
two lines with:
$_[0] = substr($Line,20,8);
$_[1] = substr($Line, 56);
I can live with this solution for this short subroutine. However, it
still annoys me that I can't figure out how to do this in the "proper"
fashion. I feel this will become important in a more complicated
subroutine when using "$_[?]" would be too cryptic.
Could someone please enlighten me as to the proper way to work with
variables by reference. Thanks.
Rossz
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 11 Oct 1999 12:19:34 -0600
From: Robert Woodworth <woodwort@utmc.utc.com>
Subject: Re: newbie question about quotes in code
Message-Id: <38022A36.74903746@utmc.utc.com>
clavikal wrote:
>
> I always get an error message (from the www) when putting quotes in HTML
> inside a perl program. Is there a way to be able to include quotes?
>
> i.e.
> print("<img src="blah/blah.gif">");
> Anything like this will give me an error.
>
> Any help is much appreciated,
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Shannon Kurtas
> skurtas@voicenet.com
> ICQ:11767795 / AOL-IM:rhclav
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> "Facts are chains that bind
> perception and fetter truth"
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
It helps to use an editor with syntax highlighting. (such as emacs with
font-lock-mode) Such an editor will highlight the quoting error.
Rob.
------------------------------
Date: Mon, 11 Oct 1999 11:33:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: parenthesizing arguments to grep - BLOCK form
Message-Id: <MPG.126bcd4c9bbeec5f98a070@nntp.hpl.hp.com>
In article <7tt1e6$15e$1@nnrp1.deja.com> on Mon, 11 Oct 1999 15:58:07
GMT, jrw32982@my-deja.com <jrw32982@my-deja.com> says...
...
> Unfortnately, {; doesn't solve my problem.
> grep({; -d $_} @ARGV);
> still generates a syntax error. So, I guess this is a bug. Do I need
> to report it? (never done that before)
We seem to be agreed that the fact that
grep(BLOCK, ...)
produces a syntax error while
grep (BLOCK, ...)
doesn't is indeed a bug. Why not report it?
`perldoc perlbug`
...
> BTW, what do you call those thingies and what exactly is their syntactic
> status.
See above.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 11 Oct 1999 13:17:24 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Passing unknown filenames as arguments to another program
Message-Id: <slrn804ad7.gep.abigail@alexandra.delanet.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCCXXXII September
MCMXCIII in <URL:news:m1r9j1zwvx.fsf@halfdome.holdit.com>:
** >>>>> "Abigail" == Abigail <abigail@delanet.com> writes:
**
** Abigail> Assuming blastcl3 can take multiple arguments:
**
** Abigail> ls *.seq | xargs blastcl3
**
** Fails if any *.seq are directories. Nearly useless use of ls there.
**
** blastcl3 *.seq
**
** would be closer.
Nope. He said "hundreds of files". Which would mean `blastcl3 *.seq'
might very well run into shell buffer limits. That's why I used the xargs.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 11:25:00 -0700
From: John Kristian <kristian@netscape.com>
Subject: Perl lite
Message-Id: <38022B7C.2B2C790F@netscape.com>
How can I make Perl occupy less disk space?
I mean without making it useless, of course.
The HTML documentation uses a lot of disk space;
eliminating it would yield a smaller footprint.
I thought I might replace it with links to the Web.
Have you tried something similar?
------------------------------
Date: 11 Oct 1999 13:18:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Question: How do I get the length of a string in PERL?
Message-Id: <slrn804afj.gep.abigail@alexandra.delanet.com>
Zak Keith (x@x.com) wrote on MMCCXXXII September MCMXCIII in
<URL:news:7tt59h$br5$1@cubacola.tninet.se>:
-- Question: How do I get the length of a string in PERL?
Not by repeatedly asking in this group.
Abigail
--
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 11:03:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Readding {boolean,int,float,longs,strings} from a file
Message-Id: <MPG.126bc66718d13e1398a06f@nntp.hpl.hp.com>
In article <7tsvvk$31$1@nnrp1.deja.com> on Mon, 11 Oct 1999 15:33:09
GMT, scott@sboss.net <scott@sboss.net> says...
...
> I want/need to be able to read boolean, int, float, longs, & strings (of
> known length) from a file. It is a binary file (archive database file)
> and I know the header, body, trailer formats. Each have parts having
> strings (in the format of string length (int) then string with no
> trailing character), ints, longs, floats, and some have boolean. I have
> found the getc command but that gets a single char. That would be good
> for the strings but the others I am at a loss for how to read the others
> from the file.
perldoc -f binmode
perldoc -f read [or sysread]
perldoc -f unpack
perldoc -f pack [for the formats used by unpack]
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 11 Oct 1999 18:22:35 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Reference of instance method
Message-Id: <7tt9tb$aia$1@pegasus.csx.cam.ac.uk>
In article <7tt78i$5p3$1@nnrp1.deja.com>, <xca1019@my-deja.com> wrote:
>Hi all,
>I want to make a call to a function.
>One parameter of the called function should
>be an reference to a function or instance
>method:
>
>$oFh=FagMods::DM::File_Log->new();
>
>$rfRef=\&Print; ### Reference to function
>$sRc=Test($rfRef); ### ==> This works
>
>$rfRef=\&{$oFh->Write}; ### Reference to method
That's not a reference to a method. It's a reference to a subroutine
whose name is the result of the method call $oFh->Write .
You can find the subroutine which implements a given method
for a given object by
my $meth_sub = $obj->can('Method');
But when you eventually call $meth_sub, you'll need to explicitly
include $obj in the arguments:
$meth_sub->($obj, @other_args);
Mike Guy
------------------------------
Date: 11 Oct 1999 18:39:00 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Sequential Debugging ? - Problems
Message-Id: <7ttas4$bf7$1@pegasus.csx.cam.ac.uk>
>My program is getting a little complex.
>
>I am using CGI.pm and myownDate.pm
>For the latter I had to add a BEGIN block to push the dir on @INC
>
>Now when I debug from the cl execution starts in one of the subroutines.
>The Debugger SKIPS the 1st 15 lines of the program.
The debugger will not (by default) stop during compilation. It will
stop at the first run-time executable statement.
So I assume the first 15 lines of your program consist of compile-time
material - use and BEGIN {} blocks - or comments etc.
If not, we'll need to see the beginning of the program to work out
what is happening.
Mike Guy
------------------------------
Date: 11 Oct 1999 18:29:59 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Shell and Perl have different $?
Message-Id: <7ttab7$6s5$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to M.J.T. Guy
<mjtg@cus.cam.ac.uk>],
who wrote in article <7tspdq$om9$1@pegasus.csx.cam.ac.uk>:
> And just to add to the fun, note that system() *can* return -1,
> indicating that one of the internal operations (e.g. fork(2) ) failed.
> In this case, the error will be in $! .
With venerable Perls you cannot get much more than this. I think that
with development versions the return of -1 is quite common. The error
is still in $! (such as file not found).
Ilya
------------------------------
Date: Mon, 11 Oct 1999 19:49:01 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: solution: howto load modules to an ISP website?
Message-Id: <Pine.HPP.3.95a.991011194644.13620C-100000@hpplus01.cern.ch>
On Mon, 11 Oct 1999 dtbaker_dejanews@my-deja.com wrote:
> I finally got this all working, so thought I would document in one
> posting in case someone else uses dejanews in the future with the same
> issue.
Fellow Usenauts, I believe we have a convert!
Can I propose a round of applause, vote of thanks, award of brownie
points or whatever form of approbation you favour?
;-)
Thanks. Good luck with your Perl programming.
------------------------------
Date: 11 Oct 1999 13:21:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Sort one array by contents of another
Message-Id: <slrn804ak1.gep.abigail@alexandra.delanet.com>
David Bown (nospam-dbown@sequent.com) wrote on MMCCXXXII September
MCMXCIII in <URL:news:01bf13d9$b9205c80$da76549e@w-skefford.uk.sequent.com>:
__
__ is there a simple way to sort the contents of two arrays into the same
__ order using only one of the arrays for comparison?
Sure. Join them, sort it, then split it.
__ I keep coming up with unecessarily complex ways of doing it, ie joining the
__ two, then sorting, then splitting. is there a simpler way?
Oh. I dunno. Joining/sorting/splitting seems pretty trivial to me.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 11 Oct 1999 13:12:45 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: We do complex Perl Programming
Message-Id: <3802289D.36A01C8B@mindspring.com>
Michel Dalle wrote:
>
> sehgal@del2.vsnl.net.in (Sahil) wrote in <7th2f6$n1u$1@news.vsnl.net.in>:
> >Hi,
> >We are an E-commerce based company and do any type of complex Perl
> >programming in record time.
>
> Congratulations. What is your record up to now ? :o
>
I wonder if people in other professions goof on want ads in this way?
------------------------------
Date: Mon, 11 Oct 1999 19:56:17 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Why's 'mailx' complaining?
Message-Id: <Pine.HPP.3.95a.991010203758.7619I-100000@hpplus01.cern.ch>
On Sun, 10 Oct 1999, MTW wrote:
> Hi - I'm about 72 hours into learning perl, and I've got quite far (for
> me, anyhow :) but have come up against this brick wall:
>
> I'm writing a simple mail rebroadcasting service for the members of my
> society (see .sig :-)
With respect, I'd counsel you that you are being over-ambitious.
Writing a mail exploder is a far from trivial task, especially guarding
against mail loops, "open relay" situations and other kinds of chaos.
Believe me, I've done that, long before packages like majordomo etc.
were available, and I've got the old scars from trying to rescue my
system from the resulting meltdown, and having to apologise to the
subscribers...
If you take my advice, look into one of the respected mail distributor
packages (go to an appropriate group to investigate what they are), and
practice your Perl skills on something else. Don't take this as general
discouragement, just as honest practical advice for this specific (and
relatively high-risk if you get it wrong) situation.
good luck
------------------------------
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 1041
**************************************