[12988] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 398 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 6 04:07:16 1999

Date: Fri, 6 Aug 1999 01:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Aug 1999     Volume: 9 Number: 398

Today's topics:
    Re: Anyone know how to use perl to parse data and gener <erict@cc.wwu.edu>
    Re: Autovivification? (Darrell Stec)
    Re: Congressional Actions threatens programmer pay rate <rick.delaney@home.com>
    Re: Congressional Actions threatens programmer pay rate <kims@emmerce.com.au>
    Re: DOS "EOF" (CTRL-Z??) (Eric Bohlman)
    Re: Efficient way to use ping...? <erict@cc.wwu.edu>
    Re: Interesting database manipulation problem <P.Gillingwater@iaea.org>
        Is there a module for SMB similar to Net::FTP? <erict@cc.wwu.edu>
    Re: MATCH CASES AND PRINT TO A FILE (Martien Verbruggen)
    Re: My Last Words on => vs comma (Bart Lateur)
    Re: My Last Words on => vs comma (Bart Lateur)
    Re: My Last Words on => vs comma (Abigail)
    Re: My Last Words on => vs comma (Abigail)
    Re: Nastiness contrary to the spirit of perl? <llornkcor@llornkcor.com>
    Re: Nastiness contrary to the spirit of perl? <llornkcor@llornkcor.com>
    Re: Nastiness contrary to the spirit of perl? <llornkcor@llornkcor.com>
    Re: newbie Q, about getting stuff out of a file <rick.delaney@home.com>
    Re: newbie Q, about getting stuff out of a file <ltl@rgsun5.viasystems.com>
    Re: newbie question: splitting hairs (Larry Rosler)
    Re: NT Apache Perl (Andreas Fehr)
    Re: Perl & Win95 (Andreas Fehr)
    Re: Perl/CGI problem: Getting Web Documents from within (Eric Bohlman)
    Re: Problem reading forms with perl (Abigail)
    Re: qr{} and quoting pattern metachars <ltl@rgsun5.viasystems.com>
    Re: qr{} and quoting pattern metachars (Abigail)
        String to hex <markmal@sprint.ca>
    Re: String to hex <rick.delaney@home.com>
    Re: String to hex <uri@sysarch.com>
    Re: String to hex (Andreas Fehr)
    Re: WRITING A TIMER IN PERL (Andreas Fehr)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 05 Aug 1999 23:14:07 -0700
From: Eric Turner <erict@cc.wwu.edu>
Subject: Re: Anyone know how to use perl to parse data and generate excel reports  automatically?
Message-Id: <37AA7D2F.20474491@cc.wwu.edu>

I seriously doubt you'll be able to create native Excel file formats
with Perl (are the MS Office file formats open to the public??). Excel
will import comma-delimited files, however. Perhaps you could create a
comma (or tab) delimited file, then import it into Excel.

Eric Turner

Wing Tang wrote:
> 
> Hello all,
> 
>     I want to know if it is possible to write a perl script that will parse
> throught data from a file and port extracted data into MS Excel spreadsheet.
> 
> Thanks,
> 
> Wing


------------------------------

Date: 06 Aug 1999 05:05:50 GMT
From: darstec@aol.com (Darrell Stec)
Subject: Re: Autovivification?
Message-Id: <19990806010550.22915.00003324@ngol05.aol.com>

In article <slrn7qj80t.ucg.abigail@alexandra.delanet.com>, abigail@delanet.com
(Abigail) writes:

>
>Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXV September MCMXCIII in
><URL:news:37ad2b32.1905128@news.skynet.be>:
>$$ Uri Guttman wrote:
>$$ 
>$$ >you don't run with use strict in general?
>$$ 
>$$ No. Especially not in one-off scripts, whuich is... most of them. See
>$$ the eternal discussion of why "strict" is not the standard option for
>$$ Perl, i.e. why YOU have to turn it on, explicitely.
>
>
>The only time I don't use "use strict;", is when I use -e.
>
>Anything that's complicated enough to put in a file gets use strict.
>Regardless whether it's going to be run once or multiple times.
>
>
>
>Abigail
>-- 
>sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
>'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
>'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
>'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
>'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
>
>
>  -----------== 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
>==-----
>

If "strict" was to be automatically turned on, it would be a problem on those
servers where there is no access to shell accounts and hence no access to the
error logs.  I have run across several web hosting sites where using the -w
switch and the strict pragma would cause the program not to run, with even so
simple a program like "Hello World".

Of course the more complex program may be producing errors which won't get past
the strict setting, but since one will never see the error logs, they will
never know. 

Later,
Darrell Stec                               E-Mail: DarStec@aol.com

Webpage Sorcery
http://webpagesorcery.com
We Put the Magic in Your Webpages




------------------------------

Date: Fri, 06 Aug 1999 05:09:05 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Congressional Actions threatens programmer pay rates encore
Message-Id: <37AA6DCE.87AE7FE4@home.com>

[posted & mailed]

Walker Rowe wrote:
[much idiocy snipped] 

Thanks, now the constant barrage of FAQs here doesn't seem so
intolerable.  Please find somewhere else to troll with this garbage. 
This group is for discussion about the Perl programming language.  Your
post had NOTHING to do with that.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: Fri, 6 Aug 1999 17:55:26 +1000
From: "Kim Saunders" <kims@emmerce.com.au>
Subject: Re: Congressional Actions threatens programmer pay rates encore
Message-Id: <933926108.422466@draal.apex.net.au>

>The market is good now and you are making lots of money.  But what will you
>do when we have another recession?  And how will you find a job make if
your
>résumé is buried under and avalanche of Indian, Chinese, Filipino, and
>European curriculum vitae.


Uh huh... well if you're as good as you think you are, yours will stand out
no matter how much money you want.

>To my European friends I would say why don't you improve your own economy
>and quit doffing off ours?  :"On the dole", isn't that what you Brits say?
>To the French and Germans I say why protect your farmers with subsidized
>crops.  Your European and French parliaments are dominated by Socialists.
>Your 17% VAT tax stymies free enterprise and hinders entrepreneurs.  Quit
>taxing your citizens so heavily.  Give your employers the right to fire
>workers and allow your businesses to award stock options.  Then you won't
>have to suffer 20% unemployment in Spain.  What happened to the
>freedom-loving ideas of the French revolution?  In 1789 the words "liberté,
>egalité, fraternité" meant freedom from the clutches of bureaucracy.  Bring
>back Voltaire and Robespierre and toss out Jacque Delors.


Ooh! Socialists! Evil! You yanks wouldn't know a thing about politics, or
anything remotely different from what you've got.  As proven by your stupid
holy wars on communism, drugs, etc that haven't got you anywhere, and merely
demonstrated your ignorance.

The fact is there's more to life than numbers. So what, there's 20%
unemployment in spain? Maybe they aren't prepared to enflict 3rd world
poverty on their citizens so that a few can be filthy rich? Or am I starting
to sound like an evil "Socialist"?

>But as we all know Europeans are only the most vocal lot of high tech
>immigrants.  By far the biggest abusers of our generous immigration laws
>wish to attract little attention and tend to remain mum.  These are the
>Indians.  Fully 42% of H1B visa go to overseas Indians.  Why don't you
>Indians practice a little capitalism in Delhi and Bombay and rid your
>economy of socialist law?  I don't dislike you personally-I have many
Indian
>friends and enjoy reading V.S. Naipal and Salman Rushdie.  And "Karma
Sutra"
>was a hell of a movie.  But when you flock here by the millions I must
>protest.


Salman Rushdie lives in england. Although I don't suppose you'd care to look
further than his name?

>To help frame this debate, the American reader of this letter needs some
>historical perspective of India and the Indian diaspora.  During the 1970
>while the United States fought a proxy war with the Russians in Afghanistan
>Indian was a Soviet ally.  The Indian economy was and in many ways today
>remains officially socialist.  Coca-Cola could not even sell their products
>there.  You could buy a Coke in Katmandu but in India they had to slap a
>non-American label on their product lest they offend the local soda pop
>bottler.  And now Indian threatens world peace with their reckless
>experiments with nuclear weapons.  No doubt their scientists garnered the
>know how to build these bombs from American universities.


Oh no! We can't sell our yank drink all over the universe! Perish the
tought! Commie bastards at work again???

Well, I come from australia, and your president has just put a 40% tariff on
australian lamb imports. You are a yank, so you can't see what americans do
to protect themselves. 40% is a HELL of a tariff. And how many lamb farmers
is this protecting??? A handful. There is barely any industry to protect.
The USA is one of the worst offenders when it comes to subsidising their own
farmers, we don't do it at all. Which means that YOU are PAYING MONEY to
make us uncompetitive.

So, india isn't allowed to restrict your drink, but you're allowed to
restrict imports of workers and produce? You have absolutely no idea how the
world actually works at all. Yanks seem incabable of seeing anything that
doesn't involve them.

>Indians come to the U.S. to find work and enjoy our democracy.  Their
>country claims to be the largest democracy on earth.  But the way they
treat
>each other is hardly democratic.  Indian culture is divided into castes-the
>untouchables are at the bottom and the brahmins at the top.  People of one
>caste do not marry or mingle with members of another caste.  In Indian most
>marriages are arranged and accompanied by a dowry.  In some cases, if the
>dowry paid in gold is not enough to please the husband then the bride is
>tossed onto a pire and burned to her death.


The USA is divided into castes, the rich, who can afford hospitals, health
care, and education, and the poor, who can't and don't stand a chance.
People who are poor and can't get an education in a school without massacres
can't get work and build their way up to the standard of the rich. Is this
"Democracy". Is "Democracy", USA style about tolerance? The kind of
tolerance that is paranoid enough to bribe and fight wars with countries
that happen to have a different political system? Is that really democracy?
Or am I just a "Socialist". Democracy, eh. Who was the last president that
wasn't WHITE or MALE? Given that democracy is about people representing
themselves, that would mean that, as in a democracy, you would have 50% of
your presidents female, and 10% black. Or is 100% of the population all
while males?

>If you want to know what the English thought of the Indians during the
>British Raj then you should read George Orwell's "Burmese Days".  (Burma is
>not actually Indian but these people are Indians.  I forget if Burma was
>once called East India but Pakistan was West India until 1970.)  During the
>British Raj the Indians were not allowed to join the English clubs.  They
>lived under a system of apartheid and were frequently referred to using the
>n-word.  Horrible I know, but that is their history.


A huh. And now to YOUR history. How did all the blacks come to the USA? By
their own free will, I suppose? (that's what you do in a "democracy", isn't
it?) I don't suppose people down south have ever used the "n-word"? Let
alone chaining someone who could be described with the "n-word" to the back
of a truck and dragging him to his death on the road? No, surely not! Not in
our precious, perfect, egalitarian "democracy"? Don't suppose there's any
members of the old KKK un the USA?

>So to you European and Indian programmers I say stay over their and
brighten
>up your own economy by embracing the ideas of Margaret Thatcher and Ronald
>Reagan style capitalism.  They did it in Hong Kong.  They did it in
>Singapore.  If you create some jobs over there you wont need to work here.
>Then we will welcome you as tourists and you can even come to my house.
We'
>ll share some mango pickles and green chilis.


Right. Well, I have no problem with your restricting immigration. Just
realise that while the USA has a face of democracy, freedom, and all that
crap, that's not what it's really like. Sure, it probably is if your white
and rich. But YOU have commited plenty of restrictions on trade yourself,
and you cry because you can't sell coke as coke in india.

KimS



------------------------------

Date: 6 Aug 1999 07:23:43 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: DOS "EOF" (CTRL-Z??)
Message-Id: <7oe2hv$ecu@dfw-ixnews6.ix.netcom.com>

Ken Hirsch (kenhirsch@myself.com) wrote:
: I'm not sure exactly what is happening, but if you
:     print "\n";
: before
:     print "The word is: $a[$num - 1]";
: 
: then you'll see the output.
: 
: Anybody know what's going on?

It's a bug in the Win95 console output routines.  Under some 
circumstances, the next line output after the user types Ctrl-Z is 
swallowed.  It's inconsistent, depending on things like where on the 
screen the line should have been printed.



------------------------------

Date: Thu, 05 Aug 1999 23:18:59 -0700
From: Eric Turner <erict@cc.wwu.edu>
Subject: Re: Efficient way to use ping...?
Message-Id: <37AA7E53.F7074FDF@cc.wwu.edu>

Check out Net::Ping (available in libnet on CPAN). It has exactly what
you're looking for. Here's a portion of the perldoc...

use Net::Ping;

$p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();

seong joon bae wrote:
> 
> Hello,
> I'm writing a script that will ping another machine and checks if the
> machine is up or down.
> I can come up with a few ways to implement this...such as getting the
> string after the ping command and compare if it's an integer or
> string..etc.
> but is there a more efficient way to do this?
> 
> also, how come some ping returns 'such such is alive' and some ping
> returns packets sent and received..?
> 
> Thank you for your help.
> =D


------------------------------

Date: Fri, 06 Aug 1999 09:06:06 +0200
From: Paul Gillingwater <P.Gillingwater@iaea.org>
Subject: Re: Interesting database manipulation problem
Message-Id: <37AA895E.8F09DA7C@iaea.org>

Abigail wrote:

> Paul Gillingwater (P.Gillingwater@iaea.org) wrote on MMCLXV September
> MCMXCIII in <URL:news:37A9A50B.CBE528F6@iaea.org>:
> !!
> !! The question is: given that there is some overlap, i.e., some people do
> !! the same jobs as other people, create a report that lists the areas of
> !! greatest overlap, i.e., a set of jobs and people in common with the
> !! greatest number of jobs in common.  Now do it again, for one less job.
> !! Then again, until no more than 5 jobs are in common.
>
> Uhm, why not do it in SQL?
>
> (And ask in an SQL group for the how)

I already decided that SQL can't do this, no matter how many funky outer joins are
used.  I'm not an SQL expert, although I've use it for over a dozen years.  I am
convinced however that Perl is the best tool for this job, and would appreciate some
guidance in how best to use the Perl language to approach this problem, which is why
I posted solely in comp.lang.perl.misc.

Thanks.



------------------------------

Date: Thu, 05 Aug 1999 23:23:44 -0700
From: Eric Turner <erict@cc.wwu.edu>
Subject: Is there a module for SMB similar to Net::FTP?
Message-Id: <37AA7F70.AADEE30F@cc.wwu.edu>

I'm interested in getting to NT shares from a Linux box using perl
scripts to automate some daily housekeeping tasks. Is there a module out
there to help me with this?

I have Samba installed on the Linux box. I suppose I could parse the
output from smbclient, but that seems like kludge.

Eric Turner


------------------------------

Date: Fri, 06 Aug 1999 05:14:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: MATCH CASES AND PRINT TO A FILE
Message-Id: <Hauq3.11$45.828@nsw.nnrp.telstra.net>

In article <37AA6131.C7A7AD54@home.com>,
	Rick Delaney <rick.delaney@home.com> writes:
> David Cassell wrote:
>> 
>> If you have Perl 5.005 you can write that as
>> 
>>     print OUTFILE if /expression/;
> 
> I don't have access to it right now to confirm, but I'd be very
> surprised if that didn't work in Perl4.  I've never had an older version
> but I'll bet it goes back even farther than that.

# perl4 -v

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
[snip]
# perl4 -l
$_ = 'banana';
print STDOUT if /na/;
__END__
banana
#

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


------------------------------

Date: Fri, 06 Aug 1999 07:28:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: My Last Words on => vs comma
Message-Id: <37ab824a.1758423@news.skynet.be>

Larry Rosler wrote:

>Perl King says...
>> A comma is
>> used in virtually all programming languages to separate arguments
>> and is easily recognized by programmers.
>
>What about separating classes of arguments?  Extra visual semantics.

Quite the contrary. "=>" is intended to point out a *closer connection*
between the it's two sides, than with a comma. Examples (from TomC's
post):

    use constant PI => 3.14159265358979;
    thefunc(START => "+5m", FINISH => "+30m");

It's not ("+m", FINISH), no: it's (START => "+5m"), (FINISH => "+30m")

>remember, => is just  fancy comma

Apart of the magic quoting. That *is* important. If you don't want iy,
don't use "=>". Everybody expects, in

	%hash = ( chr => 123, etc => 456 );

that "chr" is a string, and in 

	@ary = map chr, 65 .. 67;

that it's a function call.

	Bart.


------------------------------

Date: Fri, 06 Aug 1999 07:28:49 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: My Last Words on => vs comma
Message-Id: <37ac8429.2237314@news.skynet.be>

Tom Christiansen wrote:

>    $sepchar = grep(/,/ => @_) ? ";" : " ,";
>
>Do you understand why I did that?   Because there are already too many
>commas!  I didn't want it do get lost.

Then use the block instead:

	$sepchar = ( grep { /,/ } @_ )? ';': ' ,';


>This is the same basic reason as what I wrote in Chapter 9,
>where it mentions
>
>    join($; => $x, $y, $z)

Actually, since the left side is a string, I don't mind *that* much.
Still, it does bind (as in "precedence") wrong. To me, it reads like

    join(($;, $x), $y, $z)

but it behaves differently.

	Bart.


------------------------------

Date: 6 Aug 1999 02:55:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: My Last Words on => vs comma
Message-Id: <slrn7ql56h.uij.abigail@alexandra.delanet.com>

Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXVI September MCMXCIII
in <URL:news:37ab824a.1758423@news.skynet.be>:
%% Larry Rosler wrote:
%% 
%% >What about separating classes of arguments?  Extra visual semantics.
%% 
%% Quite the contrary. "=>" is intended to point out a *closer connection*
%% between the it's two sides, than with a comma. Examples (from TomC's
%% post):

I'm with Larry on this one:

    split   //   =>  $string;
    join    "+"  =>  1 .. 3;
    bless   {}   =>  $package;
    push    @a   =>  qw /foo bar quz/;
    system  $cmd =>  $arg1, $arg2, $arg3;
    printf  "%d" =>  17;
    substr  $str =>  0, 4;

    [[aap  => [1, 2, 3]],
     [noot => [2, 3, 4]],
     [mies => [3, 4, 5]]];

%% Apart of the magic quoting. That *is* important. If you don't want iy,
%% don't use "=>". Everybody expects, in
%% 
%% 	%hash = ( chr => 123, etc => 456 );

Nah. Do use =>

        %hash = (+chr => 123, etc => 456);



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== 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: 6 Aug 1999 03:03:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: My Last Words on => vs comma
Message-Id: <slrn7ql5l3.uij.abigail@alexandra.delanet.com>

Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXVI September MCMXCIII
in <URL:news:37ac8429.2237314@news.skynet.be>:
-- Tom Christiansen wrote:
--
-- >    join($; => $x, $y, $z)
--
-- Actually, since the left side is a string, I don't mind *that* much.
-- Still, it does bind (as in "precedence") wrong. To me, it reads like
--
--     join(($;, $x), $y, $z)
--
-- but it behaves differently.


*ponder*

I had to run it before I believed it behaved different. One would
expect Perl to flatten lists; but the prototype of join() forces
($;, $x) to be evaluated in scalar context. Scary.

I don't have the tendency to read it the way you did though.



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: 05 Aug 1999 23:59:51 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <7ln98n54.fsf@wind.localdomain>

>You're kidding, right?  Sure, a couple of people have slightly
>over-itchy flame fingers, but it's really pretty tame compared to much

yes, but its the same people doing it over, and over, and over, and
over



------------------------------

Date: 06 Aug 1999 00:07:51 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <4sid8mrs.fsf@wind.localdomain>

>This is hardly unique to our little newsgropu.  The whiners whom you're
>answering should try to take on comp.lang.c for a while.  The same
>calibre of postings as we swat down here are swatted down there as well.
>Just try posting a couple of message like these to comp.lang.c:

>And if the whiners really want cruel and sadistic posts, there are
>plenty of infinitely more nasty newsgroups you can involve yourself in,
>full of hate and pain.

why is it always, 'well THEY'RE doing it, so we should too'?
what is so hard about showing compassion? Unless you are so wrapped up
in your elitism, that you have forgotten how it feels.

-- 
 - "Peace cannot be kept by force. It can only be achieved by
    understanding."
 - "Whoever undertakes to set himself up as judge in the
 field of truth and knowledge is shipwrecked by the
 laughter of the Gods."        -A. Einstein



------------------------------

Date: 06 Aug 1999 00:12:04 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <zp05780b.fsf@wind.localdomain>

>Yeah, you might call it 'comp.lang.perl.moderated', even.

I was meaning for those of us that are sick and tired of newbie q's...


-- 
 - "Peace cannot be kept by force. It can only be achieved by
    understanding."
 - "Whoever undertakes to set himself up as judge in the
 field of truth and knowledge is shipwrecked by the
 laughter of the Gods."        -A. Einstein



------------------------------

Date: Fri, 06 Aug 1999 05:39:56 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: newbie Q, about getting stuff out of a file
Message-Id: <37AA7506.F5377B54@home.com>

[posted & mailed]

(BXTC) wrote:
> 
> My problem is that I have a file that lists a bunch of other files
> in it....like I just output "ls" to a file.  They are listed like this....
> 
> file.txt
> file2.jpg
> file3.tif
> file4.pl
> 
> etc.  and I need to extract the file names of each entry with the extention
> of ".jpg".  So out of the above list I would only need "file2.jpg".  I would
> like to assign each .jpg file its own variable/hash, or what ever is more
> appropriate.

It's hard to know which is more appropriate without knowing what you're
going to do with the names once you've stored them.

[snip]
 
> I'm sorry for bothering you all with this, I have used perldoc to get this
> far(I have other parts of the program working),

That's good.  Maybe you could post some of the relevant parts of your
program and we could help you out.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: 6 Aug 1999 06:16:16 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: newbie Q, about getting stuff out of a file
Message-Id: <7odujg$2qf$1@rguxd.viasystems.com>

(BXTC) <bxtc@forfree.at> wrote:
:>OK, I am fairly new to Perl...I have used it a little bit but usually only
:>2/3 times a year...and have never been trained so I forget everything
:>everytime I stop using it.  Anyway, I'm using linux and a fairly new version
:>of perl.  My problem is that I have a file that lists a bunch of other files
:>in it....like I just output "ls" to a file.  They are listed like this....

:>file.txt
:>file2.jpg
:>file3.tif
:>file4.pl

:>etc.  and I need to extract the file names of each entry with the extention
:>of ".jpg".  So out of the above list I would only need "file2.jpg".  I would
:>like to assign each .jpg file its own variable/hash, or what ever is more
:>appropriate.

my @filelist;
open FILE_WITH_LIST_OF_FILES, "some_list_file" 
	or die "failed open some_list_file";
while (<FILE_WITH_LIST_OF_FILES>) {
	chomp;
	push @filelist, $_ if /\.jpg$/;
}
close FILE_WITH_LIST_OF_FILES

:>So I need to open the file ....open(IL, filelist.txt);......find all lines
:>matching the jpg pattern.....If (IL =~ /.jpg/)..???.............then assign
:>each line that matched to different variable.....$_ = $v1(although the last
:>two will need to be looped somehow).......then close the file and continue
:>with my program.  I think it is easy, I'm just new, and could use some help!

:>I'm sorry for bothering you all with this, I have used perldoc to get this
:>far(I have other parts of the program working), but I also have a deadline,
:>and I don't think I'll figure it out by then by myself(and I'm the only
:>computer literate one at my work).  Again, I'd be very greatful for any
:>assistance.

C'mon y'all.  He asked nicely.  Don't slam 'im too bad.  He's got no 
mentors where he works to harass the crap out of him about being
so clueless.  He doesn't know any better.

Dude,
deadlines are great for sharpening your mind, but if you really
intend to pursue this line of work, you need to be prepared to dig a
little deeper into the documentation.  Even with the help you get
here, your program isn't going to work the way you want until you
learn more about what is going on.  Buy some books (the Camel is enough
to start).  Spend a week of your vacation at the beach reading the
books.  Then you will (well, may be) be worthy.

You now have an array named @filelist.  See "perldoc -f pop"
about one method for accessing the contents.  See "perldoc -q array"
for more than you ever wanted to know about arrays.  Skim it once.
Then if you want to do something with an array element and still
don't know how, read through it again very carefully.

Your post shows that you are "muddled" about several important syntax
issues.  You won't really be able to do any serious programming with
Perl until you resolve those problems.

First example: File handles are not something you do regular
expression matching against.  Look carefully at the syntax
in the documenation and examples.  There are lots of good
examples out there.  Keep reading.


-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


------------------------------

Date: Fri, 6 Aug 1999 00:55:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: newbie question: splitting hairs
Message-Id: <MPG.121434d0401461bc989de6@nntp.hpl.hp.com>

In article <37AA49B8.AFE6B72C@anlon.com> on Thu, 05 Aug 1999 21:34:32 -
0500, Mike <kangas@anlon.com> says...
 ... 
> while(<LIST>) {
>   $_ =~ /(\w+)\s+(\w+)\s+(\w+)/;

You have included what needn't be there ('$_ =~') and omitted what 
should be there -- a check to see if the regex matched.  If not, the 
values of $1, $2, and $3 will not be what you would expect.

>   print "The first match is $1\n";   # this will be 1, a, d
>   print "The second match is $2\n"; # this will be 2, b, e
>   print "The third match is $3\n";   # and this one will match 3, c, f
> }
> 
> The term deprecated is that something newer has come along to replace it. Either
> way I would personally stay with your first alternative because it will be more
> readable to someone else who may need to use or read your code later.

Formally, 'deprecated' means that the misfeature may disappear in future 
versions of the language.  Informally, it means that it is inadvisable 
to use it, even though things are very unlikely ever to disappear from 
Perl.

In the case of the split with no target, the risks (of secretly 
clobbering the argument list @_) outweight the potential benefits, if 
any.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 06 Aug 1999 06:17:30 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: NT Apache Perl
Message-Id: <37aa7dad.3382053@news.uniplus.ch>

On Thu, 05 Aug 1999 10:01:18 GMT, backwards.saerdna@srm.hc (Andreas
Fehr) wrote:

>
>Strange, I thought I read somewhere that Apache has changed this,
>but I have tested it on my server and it is still there...
>

Here it is:

<URL:http://www.apacheweek.com/issues/99-03-26>

Andreas


------------------------------

Date: Fri, 06 Aug 1999 06:50:19 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: Perl & Win95
Message-Id: <37aa8595.5406183@news.uniplus.ch>

On 5 Aug 1999 21:42:57 -0500, abigail@delanet.com (Abigail) wrote:

>To write `exactly', you need to have one `a', one `c', one `e', one `l',
>one `t', one `x' and one `y'.
>

And he sould take care of the order, 'ecaxtly' does not fit.

Andreas


------------------------------

Date: 6 Aug 1999 07:04:39 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl/CGI problem: Getting Web Documents from within my CGI!
Message-Id: <7oe1e7$ecu@dfw-ixnews6.ix.netcom.com>

99% Energy (dnor@NOSPAMhiline.net) wrote:
: Unfortunately I don't have Telnet access to my server since I am using a
: very limited web hosting service so I am having a hard time debugging the
: script remotely. I ran a script that checked all the library modules at the

Have you considered getting a better Web hosting service?  Seriously. 
Figure out how much more per year you'd have to pay for service that
included telnet access, figure out how much of your time you'd save by
having it, and then calculate how little your time would have to be worth
in order to justify spending the extra debugging and wheel-reinvention
time instead of the extra hosting money.  I suspect the tradeoff would be 
in favor of the more expensive hosting even if you valued your time at 
half the minimum wage.




------------------------------

Date: 6 Aug 1999 01:10:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Problem reading forms with perl
Message-Id: <slrn7qkv0m.uij.abigail@alexandra.delanet.com>

genelong@my-deja.com (genelong@my-deja.com) wrote on MMCLXVI September
MCMXCIII in <URL:news:7odj31$cdp$1@nnrp1.deja.com>:
?? Ok, elephant, now you've got me totally lost.  Please be patient.
?? 
?? What is the standard perl distribution?  I learned perl out of a book,
?? and ftp'd it to my server with ws_ftp.  I don't have any standard
?? distribution.

The standard Perl distribution is the distribution released by whoever
Larry appointed as pumpkin. Currently, that's Sarathy.

?? I am trying to get onto www.cspan.org, so far without success (it is
?? busy) - I will keep on trying.

Sure, try. And if it's still to busy, go to www.nbc.com as well.

Do you realize that the Comprehensive Perl Archive Network is known
under the name CPAN, without an s?

?? Where do I get the FAQ?  What is

The FAQ comes with Perl.

??    perldoc -q "How do I decode a CGI form"
?? 
?? Is this a unix command?  Everyone who writes perl seems to assume

Did you _try_?

?? everyone else knows unix, and I don't - I run under Windows 98/IE 5.

That can be fixed. And do you honestly believe a web browser is a 
fundamental part of your OS?




Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== 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: 6 Aug 1999 04:54:32 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: qr{} and quoting pattern metachars
Message-Id: <7odpq8$lcf$1@rguxd.viasystems.com>

Tom Christiansen <tchrist@mox.perl.com> wrote:
:>In comp.lang.perl.misc, 
:>    lee.lindley@viasystems.com writes:
:>:I thought that I understood what was happening with qr{}.  perldoc 
[snip]

:>I think Friedl's book had something about that, and here's
:>something Ilya put into recent incarnations of perlop:
[snip]

Jesus!  This will require considerable study for me to digest.  I'm
not even sure I *want* to understand this after midnight on a
Thursday night. :-)

I may be able to figure out how to think like the perl parser.  
OTOH, should I have to do so?  I'll do it because I want
to do it.  But consider that this may be a case where mere mortals
should not have to tread.

Thank you for the explanation.  Now when are you going to rewrite
Ilya's prose so that the "less than 99th percentile" masses can
understand it?  ;)  Before you waste energy on a reply, note that I
posted a more politically correct version of your assertion that some
people just aren't cut out to do this kind of work and used my
delightful wife as an example.  

I'll either assimilate Ilya's explanation or slink humiliated into
the 98th percentile. :-)

-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


------------------------------

Date: 6 Aug 1999 00:55:17 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: qr{} and quoting pattern metachars
Message-Id: <slrn7qku4t.uij.abigail@alexandra.delanet.com>

Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXVI September
MCMXCIII in <URL:news:37aa567d@cs.colorado.edu>:
!! 
!! here's something Ilya put into recent incarnations of perlop:
!! 
!!   Gory details of parsing quoted constructs
!! 
!!     Some passes discussed below are performed concurrently, but
!!     because their results are the same, we consider them
!!     individually. For different quoting constructs, Perl performs
!!     different numbers of passes, from one to five, but these passes
!!     are always performed in the same order.
!! 
!!     Finding the end
!! 
!!     Removal of backslashes before delimiters
!! 
!!     Interpolation
!! 
!!         This step is the last one for all constructs except regular
!!         expressions, which are processed further.
!! 
!!     Interpolation of regular expressions
!! 
!!     Optimization of regular expressions


This leaves me wondering where the interpolation of "\x20" constructs
happens. As far as I can tell this isn't discussed in this lengthy
section. A first guess would be the "Interpolation" part, but that
can't be, unless the paragraph "Some passes ... same order" is wrong.

Witness:

      $ perl -wle 'print "foo" =~ /o+/    ? "Yes" : "No"'
      Yes
      $ perl -wle 'print "foo" =~ /o\x2b/ ? "Yes" : "No"'
      No
      $


Note that the POSIX standard says they should be equivalent.


Also:
      $ cat t.awk
      /o+/    {print "Yes on o+"}
      /o\x2b/ {print "Yes on \\x2b"}
      $ echo "foo" | gawk -f t.awk
      Yes on o+
      Yes on o\x2b
      $



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


  -----------== 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: Fri, 6 Aug 1999 00:09:39 -0300
From: "Mark Malakanov" <markmal@sprint.ca>
Subject: String to hex
Message-Id: <F5uq3.50940$jl.33983857@newscontent-01.sprint.ca>

How to do hex-dump of a string?




------------------------------

Date: Fri, 06 Aug 1999 06:01:25 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: String to hex
Message-Id: <37AA7A12.CE0EC66B@home.com>

[posted & mailed]

Mark Malakanov wrote:
> 
> How to do hex-dump of a string?

OW:
    printf '%.2x ' => ord for split //, $string;

Wrapping is left as an exercise.

-- 
Rick Delaney
rick.delaney@home.com


------------------------------

Date: 06 Aug 1999 02:07:46 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: String to hex
Message-Id: <x7907ph26l.fsf@home.sysarch.com>

>>>>> "RD" == Rick Delaney <rick.delaney@home.com> writes:

  RD> [posted & mailed]
  RD> Mark Malakanov wrote:
  >> 
  >> How to do hex-dump of a string?

  RD> OW:
  RD>     printf '%.2x ' => ord for split //, $string;

why make your cpu sweat and my eyeballs roll?

print unpack 'H*', $string ;

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


------------------------------

Date: Fri, 06 Aug 1999 06:44:32 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: String to hex
Message-Id: <37aa841d.5030042@news.uniplus.ch>

On Fri, 6 Aug 1999 00:09:39 -0300, "Mark Malakanov"
<markmal@sprint.ca> wrote:

>How to do hex-dump of a string?
>

perldoc -f unpack

Andreas


------------------------------

Date: Fri, 06 Aug 1999 05:57:04 GMT
From: backwards.saerdna@srm.hc (Andreas Fehr)
Subject: Re: WRITING A TIMER IN PERL
Message-Id: <37aa7806.1934641@news.uniplus.ch>

On Thu, 5 Aug 1999 08:50:48 -0400, Jeff Pinyan <jeffp@crusoe.net>
wrote:

>[posted & mailed]
>
>The smarter way to implement at timer is to use Perl's alarm() function,
>an eval { } block, and $SIG{ALRM}.
>

Probably, but not on my Windows system with ActivePerl.
As this seems to interrupt the execution of a loop, this
is probably not what one wants.


Andreas


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 V9 Issue 398
*************************************


home help back first fref pref prev next nref lref last post