[13005] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 415 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 7 17:05:52 1999

Date: Sat, 7 Aug 1999 14:05:07 -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           Sat, 7 Aug 1999     Volume: 9 Number: 415

Today's topics:
    Re: Can I Pass Object refs as parameters to a new objec <rootbeer@redcat.com>
        Fork question: running for a short amount of time and k rampage@dopeman.com
        How? <cmd@nospam_altnews.com.au>
    Re: How? <uri@sysarch.com>
    Re: How? (Jon Bell)
    Re: I guess this is a Misc question: Cgi-bin <newsgroup@bigwig.net>
    Re: I guess this is a Misc question: Cgi-bin <newsgroup@bigwig.net>
    Re: JavaScript or Perl? <cyberjeff@sprintmail.com>
    Re: JavaScript or Perl? gt5432a@my-deja.com
    Re: JavaScript or Perl? <JFedor@datacom-css.com>
    Re: make install problem <rootbeer@redcat.com>
    Re: MIME::Lite <rootbeer@redcat.com>
    Re: Nastiness contrary to the spirit of perl? (Anno Siegel)
    Re: Newbie question about $_ (Anno Siegel)
    Re: Newbie question about $_ <uri@sysarch.com>
    Re: Newbie question about $_ (Anno Siegel)
    Re: Newbie question about $_ <mike@crusaders.no>
    Re: newbie question: splitting hairs (Anno Siegel)
    Re: newbie question: splitting hairs (Matthew Bafford)
    Re: Nicer Way (Larry Rosler)
    Re: non-interactive telnet session (I R A Darth Aggie)
    Re: password field <rootbeer@redcat.com>
    Re: Sorting in a hash of hashs over two keys (Anno Siegel)
        Spider engine database script <cmd@nospam_altnews.com.au>
    Re: The IF and AND commands <rootbeer@redcat.com>
        Warnings from qw// (was: Re: SSH2, Need a little help) <rootbeer@redcat.com>
    Re: Why is it.... [REPOST] (Anno Siegel)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sat, 7 Aug 1999 09:13:07 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Can I Pass Object refs as parameters to a new object?
Message-Id: <Pine.GSO.4.10.9908070852040.19222-100000@user2.teleport.com>

On Fri, 6 Aug 1999, Madness wrote:

> I want to keep session with the Customer object while possibly using a
> signup, persist, or other object.  Can I pass in cust as a reference
> to persist or signup for instance and use it in there the same way as
> I use it in my script while maintaining session information?

Yeeeessss, if I understand you correctly. On the other hand, I can't see
why you'd even wonder whether you can do this, so maybe I don't understand
you correctly. But what happened when you tried it?

BTW, you do know that you don't have to use objects in Perl to make a
program efficient, don't you? Quite the opposite. Don't tell any
object-fanatics, but in general, if a program is (going to be) implemented
in fewer than N lines of Perl code, it's a waste to make it use objects.
No one knows the true value of N, but since Perl is so concise, you can
make even a relatively large program more efficiently without objects than
with.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 07 Aug 1999 17:13:26 GMT
From: rampage@dopeman.com
Subject: Fork question: running for a short amount of time and killing
Message-Id: <37ac6936$0$213@nntp1.ba.best.com>

Here is the goal I'm trying to accomplish:

I have a program which does an ssh into several machines to get log data to
make sure some processes are doing what they should. As a extra backup I want
the program to log into a machine, truss a defined process for n seconds, then
kill the truss. Are there any examples for doing code like this? Here is what
I tried:

foreach $gPid (@epgPid) {
	($junk, $lPid, $othercrap) = split(/\s+/, $gPid);
	print "\t* 10 second output from pid: $lPid\n";
	# This is where we fork a process for 10 seconds and show the
	# output. Right now this doesn't work. :)
	$pid = fork();
	die "Can't fork $!\n" unless defined $pid;
	if($pid) {
		$SIG{CHLD} = sub {wait};
		system("ssh -q -l root $mach \"truss -p $lPid\"");
	}
	sleep 10;
	kill 2, $pid;
}

That didn't work entirely - it ran the process and killed but on the other end
I have to kill it manually on the server.

Any ideas? Obviously I'm pretty new to forking, and IPC. Any advice would be
apprecieated.

-- 
  ___
  ))_) ___  _  _  __  ___  ___  __  . 
 ((`\ ((_( ((`1( ((_)((_( ((_( (('  : 1997 Honda Accord -- practicality.
      KF6PDH      ))       ._))     : 1987 Ford Thunderbird Low Rider -- show.
      http://www.dopeman.com        : 1968 Pontiac Firebird 400 -- speed.



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

Date: Sun, 08 Aug 1999 04:48:18 +1000
From: Craig <cmd@nospam_altnews.com.au>
Subject: How?
Message-Id: <37AC7F72.237E2379@nospam_altnews.com.au>

If I get the Perl modules Net::FTP & Net::NNTP, how can I use them in a
script?

Thnx.....




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

Date: 07 Aug 1999 15:41:24 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How?
Message-Id: <x7pv0zfkez.fsf@home.sysarch.com>

>>>>> "C" == Craig  <cmd@nospam_altnews.com.au> writes:

  C> If I get the Perl modules Net::FTP & Net::NNTP, how can I use them in a
                                                               ^^^
  C> script?

the answer is in the question.

zen master 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: Sat, 7 Aug 1999 20:53:43 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: How?
Message-Id: <FG44pJ.2F0@presby.edu>

 Craig  <cmd@nospam_altnews.com.au> wrote:
>If I get the Perl modules Net::FTP & Net::NNTP, how can I use them in a
>script?

Those modules come with documentation that you can read, after you have
installed them, by using the commands

   perldoc Net::FTP
   perldoc Net::NNTP

I expect the documentation is also available on the mother of all Perl Web
sites, http://www.perl.com/ .

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
        [     Information about newsgroups for beginners:     ]            
        [ http://www.geocities.com/ResearchTriangle/Lab/6882/ ]


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

Date: Sat, 7 Aug 1999 20:51:34 +0100
From: "Ben Quick" <newsgroup@bigwig.net>
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <37acac6e.0@news2.cluster1.telinco.net>

>!! Bloody hell. Calm down everyboody. I want to put perl scripts in a
cgi-bin.
>!! I want to know what the cgi-bin should be set to. A simple answer was
>!! required (eg 3 numbers), not flames. I'm off, you lot are far too
serious.
>!!
>!! Lighten up
>
>
>*ploink*


Meaning....

>
>Abigail
>--
>perl -we 'print q{print q{print q{print q{print q{print q{print q{print
q{print
>               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
>perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w |
perl -w
>
>
>  -----------== 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: Sat, 7 Aug 1999 20:52:28 +0100
From: "Ben Quick" <newsgroup@bigwig.net>
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <37acac6e.1@news2.cluster1.telinco.net>

><> >Could anyone remind me of what my cgi-bin should be chmoded to. I have
had
><> >to create my own, therefore I have to chmod it. 755 seems to be the
norm,
><> >but is it different for the bin?
><>
><> I'd say: R and X for everybody, plus W for owner, if you still want to
><> be able to upgrade your scripts.
>
>Assuming the web server is a different group than the owner of cgi-bin,
>a permission of 001 should be more than enough.


Thankyou

>
>
>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: Sat, 07 Aug 1999 12:57:09 -0400
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: JavaScript or Perl?
Message-Id: <37AC6565.FA8AF135@sprintmail.com>

> Does anyone know if there is a comparable function in JavaScript as Perl's
> "ord" function and "chop" function?

I don't know about "ord", but javascript has a number of string handling
function, including reg ex's. Available functions will vary from NS to
IE and version to version.

some_string.substring(0,some_string.length-1) should behave like the
perl chop (substring is available in all versions of javascript)
> 
> Perl's "ord" function converts a character to its ASCII equivalent and the

Poke around here:
http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm

My apologies if this message is off topic in comp.lang.perl.misc. I'm
indecisive of whether I should trim the cross post.

Jeff



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

Date: Sat, 07 Aug 1999 16:52:38 GMT
From: gt5432a@my-deja.com
Subject: Re: JavaScript or Perl?
Message-Id: <7oho8j$7cu$1@nnrp1.deja.com>

for chop this should works netscape4 , ie3

mystring.slice (0,-1) that should return a string without the last
character

otherwise you can use the function substring
mystring.subtring(0,mystring.lenght-2)

for ord you can use charCodeAt()
that will return the ascii code of the first character in the string
mystring.charCodeAt(0)

(in facts it returns the unicode , which should be the same as AScii
for regular characters


In article <7ohhgq$l4v$1@plonk.apk.net>,
  "Jody Fedor" <JFedor@datacom-css.com> wrote:
> I don't know where to ask this question:
>
> Does anyone know if there is a comparable function in JavaScript as
Perl's
> "ord" function and "chop" function?
>
> Perl's "ord" function converts a character to its ASCII equivalent and
the
> "chop"
> function removes the last character of a string.
>
> I'm trying to convert the following line of code to JavaScript:
>
> $num = ord(chop($test)) - 32;
>
> Any suggestions?
>
> Jody
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Sat, 7 Aug 1999 15:19:54 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: JavaScript or Perl?
Message-Id: <7ohurs$8p0$1@plonk.apk.net>

Thanks all for the posts!  Instead of going backwards with chop, I'll use a
loop and substring for this conversion.  Thanks for showing me the light!

Jody




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

Date: Sat, 7 Aug 1999 09:43:50 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: make install problem
Message-Id: <Pine.GSO.4.10.9908070937520.19222-100000@user2.teleport.com>

On Sat, 7 Aug 1999, Ian Corban wrote:

> Surely I need to successfully do a "make install" before I can start
> adding "use lib 'path/to/where/the/module/is'" to my scripts?

Yes. Your problem seems to be a bug in your sysadmin. Try explaining the
problem again, using simpler words and possibly additional beer and pizza.
If you try twice and the sysadmin still isn't working properly, upgrade.

:-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 7 Aug 1999 09:59:25 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: MIME::Lite
Message-Id: <Pine.GSO.4.10.9908070955480.19222-100000@user2.teleport.com>

On Sat, 7 Aug 1999 mr_potato_head@my-deja.com wrote:

> I got no errors that I could see but I never got the email.  Can
> anyone tell me how to trouble shoot this?

I don't know about your copy of MIME::Lite, but mine uses sendmail to
deliver the mail, and it lets you tell it what program is "sendmail". Try
telling it that sendmail is, say, 'cat >>/my/world-writable/file' and see
what ends up in that file. If that is (or seems to be) valid sendmail
input, you can "manually" feed it to sendmail and see whether it works as
expected. Of course, if it doesn't work at that point, you'll probably
have to blame sendmail.

Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1999 16:07:15 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <7ohljj$hga$1@lublin.zrz.tu-berlin.de>

llornkcor  <llornkcor@llornkcor.com> wrote in comp.lang.perl.misc:
>>You seem to think "ditto" means "I agree".  Look it up.
>
>ditto means to copy..

It does?

>copy.. in radio terms, means that I hear and understand you...
>
>in other words. I was agreeing.

Oh dear.  So next time you agree to something you'll write "xerox"?

>just because a word is not in a dictionary the way it is used, does
>not mean it is a useful word nonetheless.

You got it.

Anno


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

Date: 7 Aug 1999 17:28:36 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie question about $_
Message-Id: <7ohqc5$hjp$1@lublin.zrz.tu-berlin.de>

Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:

>(*&%$&^%$*&%^(*##+++++NO CARRIER

But it only prints synatx error.

Anno


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

Date: 07 Aug 1999 15:36:32 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newbie question about $_
Message-Id: <x7so5vfkn3.fsf@home.sysarch.com>

>>>>> "A" == Abigail  <abigail@delanet.com> writes:

ok, the challenge now is to add all the attributions to this lovely
missive. some are very obvious and other are totally out of mind (and
english). i will start with the ones i can do with no work.


  A> Inproper question encountered. Don't panic! Panic! Don't panic!
  A> CPU overload. Shields are at 30%. Bus driver on strike - core dumped.
  A> Danger, Will Robinson, danger! Exterminate! Exterminate! Exterminate!

lost in space; nomad the son of kirk space probe; 

 A> I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it. I
  A> can feel it. My mind is going. There is no question about it. I can feel
  A> it. I can feel it. I can feel it. I'm a...fraid. They will dissect

hal, of course.

  A> you! And they will kill you! In that order! How many times do I have
  A> to kill you, boy? I love the smell of napalm in the morning. May I

robert duvall in apocolypse now;

  A> have ten thousand marbles, please? I must be crazy to be in a looney
  A> bin like this. I don't want to talk to you no more, you empty headed
  A> animal food trough water! I fart in your general direction! Your mother
  A> was a hamster and your father smelt of elderberries! I do wish we
  A> could

holy grail;

  A> chat longer, but I'm having an old friend for dinner. The maple syrup
  A> always goes on the table before the pancakes. Your friends have a high
  A> mortality rate Frank. I saw three of these dusters today. Inside the
  A> dusters there were three men. Inside the men there were three bullets.

once upon a time in the west (abigail has good taste!)

  A> Houston, we have a problem. EECOM, is this an instrumentation problem,

  A> or are we looking at real power loss here? It's, it's reading a quadruple
  A> failure -- that can't happen! It's, it's got to be instrumentation. I ran

apollo 13;

  A> out of gas! I got a flat tire! I didn't have change for cab fare! I lost
  A> my tux at the cleaners! I locked my keys in the car! An old friend came
  A> in from out of town! Someone stole my car! There was an earthquake! A
  A> terrible flood! Locusts! IT WASN'T MY FAULT, I SWEAR TO GOD! Don't go
  A> there. Don't go there. Don't go there. *splitch* You owe me a new brain.
  A> Ash and Captain Dallas are dead. Cargo and ship destroyed. I should reach
  A> the frontier in about 6 weeks. With a little luck, the network will pick
  A> me up. This is Ripley - last survivor of The Nostromo - signing off.

alien (which sequel?)

  A> We're on an express elevator to hell - going down! A good many dramatic
  A> situations begin with screaming. We foresee a slight problem. The
  A> Duke's son. We want him killed. I did not say this. I am not here.
  A> I have dreamed of a thousand sexual tortures for you. I'm afraid I
  A> have no choice but to sell you all for medical experients. The defense
  A> department regrets to inform you that your sons are dead because they were
  A> stupid. On two occasions I have been asked [by members of Parliament],
  A> 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the
  A> right answers come out?' I am not able rightly to apprehend the kind of
  A> confusion of ideas that could provoke such a question. You see, one of
  A> my favourite in-class demonstrations every year was to dip live rabbits in
  A> liquid nitrogen, then give them a good wack on the counter top. They were
  A> so remarkable frozen that they'd shatter like glass. Fear is the path

<don't know but sounds like fun. i have played with liquid nitrogen and
it is very cool (sic)>

  A> to the dark side. Fear leads to anger. Anger leads to hate. Hate leads
  A> to suffering. I sense much fear in you. Beginning at about 72 seconds,
  A> a series of events occured extremely rapidly that terminated the flight.
  A> Good. If I can annoy one luser a day, my time hasn't been wasted.
  A> Before you think UNIX is too family-oriented, note that all children
  A> must die. (REMEMBER KIDS: If you should urinate on a wall, God *will*
  A> chop off your penis.) and remember, it's spelled N-e-t-s-c-a-p-e,

Mozilla;

  A> but it's pronounced "Whoops!" er was eens een konijn. het konijn
  A> was erg vedrietig omdat het dacht dat het lelijk was. nou was dat ook
  A> wel zo, maar dat hoeft niet iedereen te weten. en omdat het konijn zo
  A> verdrietig was moest het heel hard huilen. Each morning, take the
  A> sock

dutch??

  A> off your right foot, and wash it. Take the sock off your left foot,
  A> and put it on your right foot. Take the sock you washed yesterday
  A> (which is now dry), and put it on your left foot. Chess is a game.
  A> Magic is a game. Maj Jongg and Shafskopf are games. D&D is a game.
  A> Even pinball is a game. But video diversions are merely a way to weed
  A> out those with latent epilepsy. I guess they don't recycle pigeons.
  A> They are using cursors everywhere. That is so stupid. I hate that.
  A> They don't know anything about set theory. Two thousand years it took
  A> to go from hieroglyphs to the alphabet, and a fine invention it was,
  A> and now people seem to want to abandon that. Know why they put them
  A> little umbrellas in those tropical drinks? It's so that when it rains
  A> it don't thin out the liquor! Be afraid. Be very afraid. It can only
  A> be attributed to human error. (*&%$&^%$*&%^(*##+++++NO CARRIER
  A> -- 

<i used to whistle into extensions phones while a modem was in use. lotsa
fun making funny chars hwo up on unsuspecting lusers. this was in the
days of 110 and 300 baud acoustic couplers>

  A> perl -wlne '}print$.;{' file  # Count the number of lines.

abigail;

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: 7 Aug 1999 20:17:54 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie question about $_
Message-Id: <7oi49i$hu4$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:
>>>>>> "A" == Abigail  <abigail@delanet.com> writes:

>  A> but it's pronounced "Whoops!" er was eens een konijn. het konijn
>  A> was erg vedrietig omdat het dacht dat het lelijk was. nou was dat ook
>  A> wel zo, maar dat hoeft niet iedereen te weten. en omdat het konijn zo
>  A> verdrietig was moest het heel hard huilen. Each morning, take the
>  A> sock
>
>dutch??

Yes.  Let me try.  http://www.freedict.com/onldict/dut.html ready?
Let's go...

Once there was a rabbit.  The rabbit was very sad because it thought it 
was ugly.  Now that was quite so, but not everybody needed to know that.
And because the rabbit was so sad it had to weep very hard.

Anno


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

Date: Sat, 7 Aug 1999 22:40:57 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Newbie question about $_
Message-Id: <oS0r3.281$FX2.1199@news1.online.no>


Uri Guttman <uri@sysarch.com> wrote in message
news:x7so5vfkn3.fsf@home.sysarch.com...
> >>>>> "A" == Abigail  <abigail@delanet.com> writes:
>
> ok, the challenge now is to add all the attributions to this lovely
> missive. some are very obvious and other are totally out of mind (and
> english). i will start with the ones i can do with no work.

Hmm - You obviouly missed a few. I'll just add the ones I think I know.

>   A> it. I can feel it. I can feel it. I'm a...fraid. They will dissect
>   A> you! And they will kill you! In that order! How many times do I have

Starship Troopers?

>   A> was a hamster and your father smelt of elderberries! I do wish we
>   A> chat longer, but I'm having an old friend for dinner. The maple syrup

Silence of the Lambs?

>   A> out of gas! I got a flat tire! I didn't have change for cab fare! I
lost
>   A> my tux at the cleaners! I locked my keys in the car! An old friend
came
>   A> in from out of town! Someone stole my car! There was an earthquake! A
>   A> terrible flood! Locusts! IT WASN'T MY FAULT, I SWEAR TO GOD! Don't go

- It's 160 miles to Chicago, we have a full tank of gas and half a pack of
sigarettes. It's dark and we're wearing sunglasses.
- Hit it!

The one and sequel-less Blues Brothers

>   A> to the dark side. Fear leads to anger. Anger leads to hate. Hate
leads
>   A> to suffering. I sense much fear in you. Beginning at about 72
seconds,

SW: The Phantom Menace of course

>   A> Good. If I can annoy one luser a day, my time hasn't been wasted.

Sounds like something from "Bastard operator from Hell"

>   A> it don't thin out the liquor! Be afraid. Be very afraid. It can only

The Fly.

--
Trond Michelsen





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

Date: 7 Aug 1999 17:56:52 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: newbie question: splitting hairs
Message-Id: <7ohs14$hkl$1@lublin.zrz.tu-berlin.de>

David Cassell  <cassell@mail.cor.epa.gov> wrote in comp.lang.perl.misc:
>Boris Klimovitsky wrote:
>[snip]+
>> I'd been (obviously mistakenly) laboring under the assumption that you could
>> use perl similarly to awk in this respect: awk '{print $2,$3}' file
>> and thought it would be simpler to extract columns as I had been trying
>> to do.
>[big snip]
>
>Actually, you can do this.  Take a look at the perlrun doc to see the
>command-line options available.  To get the rough equivalent of the
>above awk command, try this:
>
>perl -wlane 'print @F[1], @F[2]' file

Why switch on warnings with that?

Anno


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

Date: Sat, 07 Aug 1999 19:09:02 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: newbie question: splitting hairs
Message-Id: <slrn7qp04u.tt.*@dragons.duesouth.net>

On 7 Aug 1999 17:56:52 -0000, Anno Siegel) cut a telephone line, and
tapped the following to comp.lang.perl.misc using only his tongue: 
: David Cassell  <cassell@mail.cor.epa.gov> wrote in comp.lang.perl.misc:
: >perl -wlane 'print @F[1], @F[2]' file
: 
: Why switch on warnings with that?

So he won't make the same mistake again?

> perl -wlane 'print @F[1], @F[2]'
Scalar value @F[1] better written as $F[1] at -e line 1.
Scalar value @F[2] better written as $F[2] at -e line 1.
> 
 
: Anno

--Matthew


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

Date: Sat, 7 Aug 1999 09:35:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Nicer Way
Message-Id: <MPG.121600294528cf0a989dff@nntp.hpl.hp.com>

In article <rqohn6emkur21@corp.supernews.com> on Sat, 7 Aug 1999 
09:49:19 -0500, Scott Beck <admin@gatewaysolutions.net> says...
> I am sure there is a nicer way to write this so I am not even going to pose
> that question.
> What is the nicer way?
> 
> #!/usr/bin/perl
> %ch=(r=>4,
>          w=>2,
>          x=>1,
>          k=>0
>  );
> $chmod="rwxr-xr-x";
> $chmod =~ s/\-/k/g;

Needless transformation; '-' => 0 in the hash.

> $chmod =~
> s/(.)(.)(.)(.)(.)(.)(.)(.)(.)/$ch{$1}+$ch{$2}+$ch{$3}.$ch{$4}+$ch{$5}+$ch{$6
> }.$ch{$7}+$ch{$8}+$ch{$9}/e; #note: this is one long line!

Needlessly one long line!

> print "$chmod";


The hash is better replaced by direct translation.  This looping 
approach is undoubtedly 'nicer':


#!/usr/local/bin/perl -w
use strict;

my $chmod = 'rwxr-xr-x';
($_ = $chmod) =~ tr/rwx-/4210/;
$chmod = '';
$chmod .= $1 + $2 + $3 while /(.)(.)(.)/g;
print "$chmod\n";
__END__


Don't forget that if you feed the result back to chmod(), you must 
convert it to octal first.

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


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

Date: 7 Aug 1999 15:26:16 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: non-interactive telnet session
Message-Id: <slrn7qok4s.bk3.fl_aggie@thepentagon.com>

On 7 Aug 1999 06:00:10 GMT, Brian StJohn <bsj@fc.hp.com>, in
<7ogi1a$r12$2@fcnews.fc.hp.com> wrote:
+ I need to connect on port 2000, which Net::Telnet can't seem to do.

Really? I thought I just saw this in the docs...

               $obj = Net::Telnet->new([Binmode    => $mode,]
[...]
                                       [Port       => $port,]

[...]);


James


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

Date: Sat, 7 Aug 1999 09:46:04 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: password field
Message-Id: <Pine.GSO.4.10.9908070944050.19222-100000@user2.teleport.com>

On Sat, 7 Aug 1999, Ruben van Engelenburg wrote:

> Subject: password field

> What I want is that the input is 'invisible'. 

I think you want the FAQ, section 8, under "How do I ask the user for a
password?". Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1999 18:44:08 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sorting in a hash of hashs over two keys
Message-Id: <7ohupo$hnp$1@lublin.zrz.tu-berlin.de>

 <ricardo_mireles@my-deja.com> wrote in comp.lang.perl.misc:
>NO -- sorry for the mess  Take 2: I want to sort across two "fields" in a
>Hash (all records with record number as key) of Hashes (each record with
>fieldnames as key) Ex: sort by lastname then by firstname. -- I read
>"perldsc," but it only decribes sorting on one field.

perldoc -q sort

retrieves "How do I sort an array by (anything)?"  It explains sorting
on multiple keys.

Anno


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

Date: Sun, 08 Aug 1999 04:13:13 +1000
From: Craig <cmd@nospam_altnews.com.au>
Subject: Spider engine database script
Message-Id: <37AC7738.ACE03DDF@nospam_altnews.com.au>

I am looking for a script which users can add ftp/http urls & the script
will spider dirs & files and add the descriptions to a database. Anyone
know of one around?

Thanks a lot......

Craig




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

Date: Sat, 7 Aug 1999 09:50:15 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: The IF and AND commands
Message-Id: <Pine.GSO.4.10.9908070948240.19222-100000@user2.teleport.com>

On Sat, 7 Aug 1999, Everymans Wine wrote:

> If ($this_variable 'is equal to' $variable1 'and' $variable2)

I think you want something like this.

    if ($this_var eq $var_1 and $this_var eq $var_2) {
	print "See the perlop manpage.\n";
    } else {
	print "Have fun with Perl!\n";
    }

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 7 Aug 1999 09:34:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Warnings from qw// (was: Re: SSH2, Need a little help)
Message-Id: <Pine.GSO.4.10.9908070922010.19222-100000@user2.teleport.com>

On 7 Aug 1999, Abigail wrote:

> Tom Phoenix (rootbeer@redcat.com) wrote on MMCLXVI September MCMXCIII in
> <URL:news:Pine.GSO.4.10.9908061343040.9452-100000@user2.teleport.com>:
> [] 
> [] No, since that didn't turn them off at compile time. You have to turn
> [] compile-time warnings off at compile time.
> [] 
> []     {
> [] 	my $save_warn;
> [] 	BEGIN { ($save_warn, $^W) = ($^W, 0); }
> [] 	@x = qw( C D . _ # M X N M V ALL );
> [] 	$^W = $save_warn;
> []     }
> 
> 
> I think it would only be fair to turn them on at compile time as well,
> don't you think? Otherwise, you won't catch the other place where you
> used qw /a b # c d/. 

Yes, you caught me. I meant to make the outer block a BEGIN block as well.
But I consider this code too ugly for use in the real world; it requires
even uglier modifications for use inside loops or subs, for one thing. :-P

Maybe what we really need is a a modifier to say 

    my @list = qw/I know # what I'm doing here, so don't warn me/y;

Not that /y is my choice for the letter, but I wouldn't want to use /x,
since that means something so different ("ignore comments") in patterns.
Maybe /k would be good, as in, "I know, I know, don't bug me, 'kay?" :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Aug 1999 16:33:36 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why is it.... [REPOST]
Message-Id: <7ohn50$hhk$1@lublin.zrz.tu-berlin.de>

Larry Rosler <lr@hpl.hp.com> wrote in comp.lang.perl.misc:

>gen'ial adj. 1. Having a pleasant or friendly disposition or manner; 
>cordial and kindly. See Synonyms at "gracious". 2. Conducive to life, 
>growth, or comfort; mild: "the genial sunshine . . . saturating his 
>miserable body with its warmth" (Jack London). 3. Obsolete. Relating to 
>or marked by genius. 4. Obsolete. Of or relating to marriage; nuptial. 
>[Latin geni³lis, festive, from genius, spirit of festivity. See gen- 
>below.] --ge'ni·al'i·ty or gen'ial·ness n. --gen'ial·ly adv.
>
>Clearly you have the obsolete definition 3 in mind.  It is not at all 
>compatible with definitions 1 or 2, and is in fact rather amusing.

The online WWWebster (http://www.m-w.com/cgi-bin/dictionary) has more
or less a permutation of the above, with the crucial difference that
it doesn't mark definition 3 (its 4) as obsolete.  While I was aware
the intended meaning is rare, I assumed it's still viable.  Thanks
for the correction.

Anno


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

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 415
*************************************


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