[17127] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4539 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 6 14:05:39 2000

Date: Fri, 6 Oct 2000 11:05:16 -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: <970855516-v9-i4539@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 6 Oct 2000     Volume: 9 Number: 4539

Today's topics:
         HOW Mirror2.9 using Sockets or Proxy <steve@datapost.co.za>
    Re: 5.005_03, British Summer Time and caching Gordon.Haverland@agric.gov.ab.ca
    Re: [Fwd: reading a secret] <anmcguire@ce.mediaone.net>
        Autologin script hurricane_number_one@my-deja.com
    Re: Autologin script (Clay Irving)
    Re: Autologin script <jargoone@hotmail.com>
    Re: beginner question (Jon S.)
    Re: beginner question (Keith Calvert Ivey)
        Bug? (Denis Joiret)
    Re: Bug? <franl-removethis@world.omitthis.std.com>
    Re: Bug? (Sean McAfee)
    Re: Can't lock error <jpsmith@mediom.qc.ca>
        Code for Multiple Regression in Perl? lefkogt@my-deja.com
    Re: Date problem (Clay Irving)
    Re: Date problem <anmcguire@ce.mediaone.net>
        Editing in place with multiline regexes? (Jesse Sheidlower)
    Re: Editing in place with multiline regexes? (Rafael Garcia-Suarez)
    Re: Eliminate Duplicates <mischief@motion.net>
        factorial function problem iamnotananimal@my-deja.com
        Fileinput <cyberoli@gmx.at>
    Re: Fileinput <foo@bar.va>
    Re: Fileinput <tim@ipac.caltech.edu>
    Re: Formating output to be read in a form. <juex@deja.com>
        Gd library <NCR.Employee@NCR.COM>
        Getting Current Directory info Ben@sebborn.f9.co.uk
    Re: Help processing files in a directory <michael.segulja@sgi-lsi.com>
    Re: How to find IP address by MAC address? <pangjo@hotmail.com>
        How to make a table? lynton@iname.com
    Re: How to make a table? <bmb@ginger.libs.uga.edu>
    Re: how to unlink this file? <anmcguire@ce.mediaone.net>
    Re: Internet Website Survey Script <rlwm@mindspring.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 6 Oct 2000 17:57:09 +0200
From: "Steve Ronald" <steve@datapost.co.za>
Subject:  HOW Mirror2.9 using Sockets or Proxy
Message-Id: <39ddf6ea$0$236@hades.is.co.za>

Hi
I have been using Mirror 2.9 between a couple of my machines, Linux and
windoze 2k in both directions with no problems.
Recently I had need to do some mirroring via a proxy (squid on port 3128)
and socks : 1080

After setting it all up according to the docs etc. nothing works.
The same machines can use the same proxy settings (other software works with
the proxy setup socks & squid)
Other mirror software works (albeit not perl stuff)
Lwp routines work fine with perl and proxies.

Mirror just sits with "connecting to etc..." then hangs with a timeout.
Mirror  uses lchat.pl which does the socket stuf.

I have seen no other people having similar problems on the net.
Either it is a Global conspiracy - everybody is keeping quiet about it just
to frustrate ME.

Or...... I messed up somewhere. ..................   Let me think now...

I'm pretty sure all the package files are correct (defaults and individuals)
well .. they must be mostly right as teh only difference between proxy and
non-proxy is :

proxy=true
using_socks=true
proxy_ftp_port=1080
proxy_gateway=blah.blah.blah
-------------------------------
or no socks
proxy_ftp_port=3128


Steve




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

Date: Fri, 06 Oct 2000 13:53:10 GMT
From: Gordon.Haverland@agric.gov.ab.ca
Subject: Re: 5.005_03, British Summer Time and caching
Message-Id: <39ddd826.346518752@news.gov.ab.ca>

On Fri, 06 Oct 2000 09:35:54 GMT, steven <steven@ircnet.dk> wrote:

>A company that produces a content management system has told us that
>Perl 5.005_03 has a bug in it that prevents caching from functioning
>during British Summer Time, and they've patched it to make it work. I've
>never heard of this bug before, and it prevents me from upgrading Perl
>on our boxes. I can't find anything searching Deja, can anyone shed any
>light on this?

I don't know about British Summer Time specifically, but I have had
some fun dealing with time zones, mostly in the context of email
messages.  There is a perl module which hopes to be the Swiss Army
hatchett of time/date arithmetic (name escapes me at present, it's at
CPAN and purports to do just about everything).  With that module,
something like 10% of the dates I see in email addressed to me cannot
be parsed, and it is all due to the time zone specification (it would
be nice if everyone would just use the numeric +0600 (or whatever)
specification).  Anyway, I wrote a bunch of code to wrap around this
perl module just to deal with time zones, and it now handles a bit
more than 90% of the email I get.  In order to improve it any more, a
person needs to analyse other parts of the header, because the same
time zone strings are used in mulitple parts of the world.

Maybe this helps, I don't know.  It is worth what you paid for it
(nothing :-).

Gord



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

Date: Fri, 6 Oct 2000 11:23:21 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: [Fwd: reading a secret]
Message-Id: <Pine.LNX.4.21.0010061122560.12131-100000@hawk.ce.mediaone.net>

On Thu, 5 Oct 2000, Bap quoth:

B> I am resending this as it seems that only the most recent postings get
B> looked at!

That is not very polite!

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: Fri, 06 Oct 2000 16:03:04 GMT
From: hurricane_number_one@my-deja.com
Subject: Autologin script
Message-Id: <8rkt3j$esl$1@nnrp1.deja.com>

How can I write a perl script that can log in for me?  I want to be able
to execute a command like "su" or "scp" in perl and have it enter my
username and password for me. If I have my perl script execute a command
like `scp filename user@remotehost:/path` or `su`, I get the password
prompt on the command line.  How do I make my perl script send my
password to this prompt?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 6 Oct 2000 16:15:55 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Autologin script
Message-Id: <slrn8trulr.1fd.clay@panix6.panix.com>

On Fri, 06 Oct 2000 16:03:04 GMT, hurricane_number_one@my-deja.com 
<hurricane_number_one@my-deja.com> wrote:

>How can I write a perl script that can log in for me?  I want to be able
>to execute a command like "su" or "scp" in perl and have it enter my
>username and password for me. If I have my perl script execute a command
>like `scp filename user@remotehost:/path` or `su`, I get the password
>prompt on the command line.  How do I make my perl script send my
>password to this prompt?

Expect?

  NAME
                 Expect.pm - Expect for Perl
  
  
  SYNOPSIS
         Expect.pm is built to either spawn a process or take an
         existing filehandle and interact with it such that
         normally interactive tasks can be done without operator
         assistance. 
[...]

-- 
Clay Irving <clay@panix.com>
Is there life before death? 
- Belfast Graffito 


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

Date: Fri, 06 Oct 2000 16:23:30 GMT
From: [ jargoone ] <jargoone@hotmail.com>
Subject: Re: Autologin script
Message-Id: <8rku9p$fvf$1@nnrp1.deja.com>

In article <8rkt3j$esl$1@nnrp1.deja.com>,
  hurricane_number_one@my-deja.com wrote:
> How do I make my perl script send my password to this prompt?

this is a stupid idea.  nevertheless, there are tools that help you do
stupid things.

check out http://expect.nist.gov/.

--
--jgn


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 06 Oct 2000 15:12:09 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: beginner question
Message-Id: <39dde3da.4962169@news.earthlink.net>

On Thu, 05 Oct 2000 13:41:29 -0700, Gordon Vrdoljak
<vrdoljak@uclink.berkeley.edu> wrote:

>Hello,
>I was having some trouble with extracting days from the localtime function in
>perl.  I noticed the following in an example but don't understand it:
>
>$thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]];
>
>The best I can see is that the string thisday is assigned to array element 6 of
>localtime function and then the weekday is somehow pulled out of this.  Can
>anyone break it down into smaller steps where I can see how the day is assigned?

Gordon,

I was completely thrown by this until I realized that the count of x
in localtime(x) starts at 0, not at 1.

So, localtime(6) is actually the 7th element of the list:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)

Or $wday.

(Why do I know this?  Because I spent a lot of time trying to get the
current year by using "6" instead of "5".  So, I'm a newbie
bonehead...  *sigh*)

Anyway, once you have it in your head that the count is from 0 instead
of 1, the rest of the localtime doc makes sense.  (At least it did to
this newbie.)

Jon


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

Date: Fri, 06 Oct 2000 14:56:35 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: beginner question
Message-Id: <39dee6ee.57929051@news.newsguy.com>

Larry Rosler <lr@hpl.hp.com> wrote:
>In article <39dd0bf4.1863033@news.newsguy.com>, kcivey@cpcug.org says...
>> Larry Rosler <lr@hpl.hp.com> wrote:
>> 
>> >qw(Sun Mon Tue Wed Thu Fri Sat)[...]
>> >                       Use the numerical day of the week to extract
>> >                       the name from a list of names.  I have corrected
>> >                       the expression so it doesn't use barewords,
>> >                       which would draw a warning.
>> 
>> I think you need another set of parentheses there.
>
>I thought so also, until I tested the code without them, and it worked 
>fine.  So I saved two keystrokes, at the cost of this subthread.  :-)

I tested too, of course, but not in 5.6.  I apologize for the
subthread.  I still think that at this stage 5.6-only code
should be indicated as such in newsgroup discussions.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: 6 Oct 2000 16:19:46 GMT
From: joiret@crow.inria.fr (Denis Joiret)
Subject: Bug?
Message-Id: <8rku32$eu3$1@ites.inria.fr>

Hello,

I think I discovered a bug in recent versions of perl5.

When a boolean expression is evaluated in a list context, and the value of the
expression is "false", the value of the expression (0 or '') is removed from
the list.
This behaviour appeared with release 5.004, and is still present in release
5.6.

Here is a little script that demonstrates the problem:
------
#!/usr/local/bin/perl
 
@x = ("One", "Y" =~ /X/, "Two");
# @x should contain ("One", "", "Two"), but actually contains ("One", "Two")
print scalar @x, "\t\"$x[1]\"\n";
 
@y = ("One", "Y" =~ /Y/i, "Two");
# correct: @y contains ("One", 1, "Two")
print scalar @y, "\t\"$y[1]\"\n";
------

Next are some executions of the script showing that with version 5.003, the
script works, but not with more recent versions:

crow% perl5.003 foo.pl
3       ""
3       "1"
crow% perl5.00501  foo.pl
2       "Two"
3       "1"
crow% perl5.6.0  foo.pl
2       "Two"
3       "1"

One solution to make things work is to add 0 to the boolean expression as in:
@x = ("One", ("X" =~ /Y/)+0, "Two");
then the result is correct:
crow% perl5.6.0  foo.pl
3       "0"
3       "1"

I hope this bug be fixed in a future version.

-- 
                                      Denis Joiret
                                      Administrateur Reseaux INRIA-Rocquencourt

Email: Denis.Joiret@INRIA.Fr
Phone: +33 1 39 63 53 82     Fax: +33 1 39 63 55 96


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

Date: Fri, 6 Oct 2000 16:50:22 GMT
From: Francis Litterio <franl-removethis@world.omitthis.std.com>
Subject: Re: Bug?
Message-Id: <m3hf6pj4mp.fsf@franl.andover.net>

joiret@crow.inria.fr (Denis Joiret) writes:

> @x = ("One", "Y" =~ /X/, "Two");
> # @x should contain ("One", "", "Two"), but actually contains ("One", "Two")

In list context, =~ returns an empty array upon failure.  In scalar
context, =~ returns undef upon failure.  In the code above, the empty
array returned by =~ is being elided from the list.  It's the same thing
that makes this list only 4 elements long:

	@x = (1, 2, (), 4, 5);
--
Francis Litterio
franl-removethis@world.std.omit-this.com
PGP public keys available on keyservers.


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

Date: Fri, 06 Oct 2000 17:01:12 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Bug?
Message-Id: <sznD5.6015$O5.127873@news.itd.umich.edu>

In article <8rku32$eu3$1@ites.inria.fr>,
Denis Joiret <joiret@crow.inria.fr> wrote:
>I think I discovered a bug in recent versions of perl5.

>When a boolean expression is evaluated in a list context, and the value of the
>expression is "false", the value of the expression (0 or '') is removed from
>the list.
>This behaviour appeared with release 5.004, and is still present in release
>5.6.

>@x = ("One", "Y" =~ /X/, "Two");
># @x should contain ("One", "", "Two"), but actually contains ("One", "Two")
 
This isn't a bug; the matching operator behaves differently in list
context.  From perlop (emphasis added):
 
   If the /g option is not used, m// in a list context
   returns a list consisting of the subexpressions
   matched by the parentheses in the pattern, i.e.,
   ($1, $2, $3...).  (Note that here $1 etc. are also
   set, and that this differs from Perl 4's behavior.)
   When there are no parentheses in the pattern, the
   return value is the list (1) for success.  With or
   without parentheses, an empty list is returned upon
   failure.             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ^^^^^^^
>One solution to make things work is to add 0 to the boolean expression as in:
>@x = ("One", ("X" =~ /Y/)+0, "Two");

This works because the match is now in scalar context.  It would probably
be clearer to use the scalar function:

@x = ("One", scalar "X" =~ /Y/, "Two");

-- 
Sean McAfee                                                mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!


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

Date: Fri, 06 Oct 2000 13:19:08 GMT
From: "Smitty" <jpsmith@mediom.qc.ca>
Subject: Re: Can't lock error
Message-Id: <01c02f98$d4e84460$332571d8@jpsmith>

I'm sorry to be an inexperienced group user...
Here is the problem I have:
The perl routine is:

open (FILE, ">>$data") || die "I can't open $data\n";
if ($useflock) {
flock (FILE, 2) or die "can't lock data file\n";
}

The error generated is :

Content-type: text/html
The following error occurred : can't lock data file

That error occurs with perl 5.001 not with perl 5.003 (I tested it).
Also when I cancel the 'flock' command, the script runs ok... but it is
surely unsafe!

Do you know if there is a special option or formatting for the flock
command in Perl 5.001?

Thanks a lot.
JPSmith


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

Date: Fri, 06 Oct 2000 14:44:43 GMT
From: lefkogt@my-deja.com
Subject: Code for Multiple Regression in Perl?
Message-Id: <8rkogo$ahu$1@nnrp1.deja.com>

Greetings
  (1) How daunting is the task of programming in Perl a multiple
regression with four predictor variables and one criterion variable?
The four variables are entered all at once.
  (2) Is there an existing Perl resource somewhere that has code for a
multiple regression as mentioned above?
Gary


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 6 Oct 2000 14:22:44 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Date problem
Message-Id: <slrn8tro1k.m79.clay@panix6.panix.com>

On Fri, 06 Oct 2000 12:30:02 -0000, IJ <meej@sol.dk> wrote:

>Problem: $date has an output like this: 1900100.10.07, instead of the 
>correct format 2000.10.07. If somebody has a ready script/suggestion for 
>this please drop it to me as soon as possible.

Try:

  perldoc -f localtime

You'll see:

  Note that the $year element is I<not> simply the last two digits of
  the year.  If you assume it is, then you create non-Y2K-compliant
  programs--and you wouldn't want to do that, would you?
  
  The proper way to get a complete 4-digit year is simply:
  
          $year += 1900;
  
  And to get the last two digits of the year (e.g., '01' in 2001) do:
  
          $year = sprintf("%02d", $year % 100);

-- 
Clay Irving <clay@panix.com>
For a while I didn't have a car...I had a helicopter...no place to park it, so
I just tied it to a lamp post and left it running...(slow glance upward)
- Steven Wright 


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

Date: Fri, 6 Oct 2000 10:49:17 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Date problem
Message-Id: <Pine.LNX.4.21.0010061046110.12117-100000@hawk.ce.mediaone.net>

On Fri, 6 Oct 2000, IJ quoth:

I> Hi,
I> Problem: $date has an output like this: 1900100.10.07, instead of the 
I> correct format 2000.10.07. If somebody has a ready script/suggestion for 
I> this please drop it to me as soon as possible.
I> 

Without seeing a script, I will venture a guess and say that whoever wrote
that script used localtime, but does not grok how it works.

perldoc -f localtime
perldoc -q y2k

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: 6 Oct 2000 09:52:48 -0400
From: jester@panix.com (Jesse Sheidlower)
Subject: Editing in place with multiline regexes?
Message-Id: <8rklfg$la9$1@panix2.panix.com>

I'm having a problem that seems as if it should have a simple solution,
but I can't find it. I've read the FAQ and the docs and can figure out
more complicated solutions, but was hoping there's something easier.

Basically, I just want to apply some editing regexes to files, but I
want to get the whole file into the variable at once, since some of
the regexes need to operate across line boundaries (I'm deleting newlines,
too, since they're not needed for the file I want to output). 

If it weren't for the multiline issue, I'd just do:
#!/user/bin/perl -pi.old
[regexes]

But this only reads in the files line by line. My various solutions 
seem to include making two passes (e.g. going through the files
first to strip out newlines, and then running the above program, or
having one program that strips the newlines pipe the output into
this one), or expanding the "-pi.old" flag into the long code it
is equivalent to, so that I can undef $/ manually. Any of these seem
a lot of work. Is there some way to undef $/ in a way that will work
with the -pi stuff, or is there some other obvious solution?

Thanks.

Jesse Sheidlower
<jester@panix.com>


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

Date: Fri, 06 Oct 2000 14:06:28 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Editing in place with multiline regexes?
Message-Id: <slrn8trnfv.adu.rgarciasuarez@rafael.kazibao.net>

Jesse Sheidlower wrote in comp.lang.perl.misc:
>I'm having a problem that seems as if it should have a simple solution,
>but I can't find it. I've read the FAQ and the docs and can figure out
>more complicated solutions, but was hoping there's something easier.
>
>Basically, I just want to apply some editing regexes to files, but I
>want to get the whole file into the variable at once, since some of
>the regexes need to operate across line boundaries (I'm deleting newlines,
>too, since they're not needed for the file I want to output). 
>
>If it weren't for the multiline issue, I'd just do:
>#!/user/bin/perl -pi.old
>[regexes]
>
>But this only reads in the files line by line. My various solutions 
>seem to include making two passes (e.g. going through the files
>first to strip out newlines, and then running the above program, or
>having one program that strips the newlines pipe the output into
>this one), or expanding the "-pi.old" flag into the long code it
>is equivalent to, so that I can undef $/ manually. Any of these seem
>a lot of work. Is there some way to undef $/ in a way that will work
>with the -pi stuff, or is there some other obvious solution?

Use a begin block:

#!/user/bin/perl -pi.old
BEGIN { undef $/ }
[regexes]

or, use the -0 command-line argument (see perlrun) :

#!/user/bin/perl -0777 -pi.old
[regexes]

-- 
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 6 Oct 2000 10:19:55 -0500
From: Chris Stith <mischief@motion.net>
Subject: Re: Eliminate Duplicates
Message-Id: <Pine.LNX.4.21.0010060944530.3875-100000@velma.motion.net>

On Thu, 5 Oct 2000, Sanjay Bhatia wrote:

> Good one!
> 
> sb

Probably better if I'd used exists() instead of defined(), but 
for all its little psuedocode glory, no one has pointed out its
deficiencies to me in email, and I've been overwheled at work so
I haven't been to the group in weeks.

 
> 
> In comp.lang.perl.misc you write:
> 
> >### code
> >if(defined) {
> >    #leave it alone
> >} else {
> >    #set the value associated with the key
> >}
> >### endcode
> 
> >then the value you get back out of the hash will indeed be the first value.
> >If not, it will be the last value assigned. These hold true, of course, only
> >if you haven't created a workaround for colliding key names.
> 
> >> cheers,
> >>
> >> big
> 
> >Bottoms up.
> 
> >> (failing to salivate over being asked to produce the "first" entry in a
> >hash :-)
> 
> >Well, if you mean "first" as in according to a sorted order, then I see your
> >point. I think Tom was referring to the first occurrence of the same value,
> >or the same named reference to a value in the case that you do use a hash.
> 

-- 
Christopher E. Stith
mischief@motion.net



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

Date: Fri, 06 Oct 2000 16:33:40 GMT
From: iamnotananimal@my-deja.com
Subject: factorial function problem
Message-Id: <8rkut4$ggk$1@nnrp1.deja.com>

Would someone correct this script. I'm only starting.

!#/usr/bin/perl
print "Number?"; $n = <STDIN>;
factorial();
sub factorial {
        my($n) = shift;
        return(1) if $n == 1;
        return($n * factorial($n-1));
                }
TIA,
ianaa


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 06 Oct 2000 13:20:08 GMT
From: Oliver Martin <cyberoli@gmx.at>
Subject: Fileinput
Message-Id: <8rkji1$5qh$1@nnrp1.deja.com>

I want to know how I magnaged the following: I want to start an PERL
Script with the following syntax: perlscriptname valuename. The script
shuold take the valuename and assingend that to an variable. I managed
to work the script with STDIN but that is not the case I mentioned
above.

Thanks.

Oli


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 06 Oct 2000 15:34:04 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: Fileinput
Message-Id: <39DDD4CB.BAA0E75@bar.va>

Oliver,

Oliver Martin wrote:
> I want to know how I magnaged the following: I want to start an 
> PERL Script with the following syntax: perlscriptname valuename. 
> The script shuold take the valuename and assingend that to 
> an variable. I managed to work the script with STDIN but that is 
> not the case I mentioned above.

	$ perldoc perlvar

 ...pointing your attention to the @ARGV array. ;)


	Best regards,
		Marco


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

Date: Fri, 06 Oct 2000 10:44:12 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Fileinput
Message-Id: <39DE0F6C.F4DBE4EF@ipac.caltech.edu>

Oliver Martin wrote:
> 
> I want to know how I magnaged the following: I want to start an PERL
> Script with the following syntax: perlscriptname valuename. The script
> shuold take the valuename and assingend that to an variable.

perldoc perlvar (or the equivalent on your platform)

Read about the @ARGV variable.

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Fri, 6 Oct 2000 09:46:04 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Formating output to be read in a form.
Message-Id: <39de0160$1@news.microsoft.com>

"Phil Latio" <verybig@thebedroom.co.uk> wrote in message
news:8rhp12$3q2$1@uranium.btinternet.com...
> >Learn to type, at your shell prompt, commands starting with perldoc
>
> I don't have shell access.

I can hardly believe that. What kind of OS are you using? I honestly haven't
heard of any OS that doesn't support at least some sort of shell (well,
maybe PDAs, Palmtops, or a TI-59. But you wouldn't use those to write Perl
programs anyway).

jue




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

Date: Fri, 6 Oct 2000 10:12:51 -0400
From: "NCR Employee" <NCR.Employee@NCR.COM>
Subject: Gd library
Message-Id: <39dddde9@rpc1284.daytonoh.ncr.com>

We have been using the GD library that is available from ActiveState's
ActivePerl via the ppm library.  With our latest upgrade, the perl programs
appear to still work, but the image does not display.

Does anyone know a fix for this?

Thank you,

Kim Kulasa
NCR




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

Date: Fri, 06 Oct 2000 14:33:12 GMT
From: Ben@sebborn.f9.co.uk
Subject: Getting Current Directory info
Message-Id: <8rknr8$9u1$1@nnrp1.deja.com>

Hi there,

I need to get the name of the current directory a user is in, for a
navigation system.

I think the best way is to use $ENV{REQUEST_URI}

How can I convert  www.domain.com/directory/page.ext

into

directory

It needs to work whether the URL says :

domain.com/directory   OR
domain.com/directory/  OR
domain.com/directory/page.htm

It is only the directory name I need to use.

Anyone any ideas?

Thanks folks!

Ben



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 06 Oct 2000 13:40:59 GMT
From: Michael Segulja <michael.segulja@sgi-lsi.com>
Subject: Re: Help processing files in a directory
Message-Id: <8rkkpa$6tg$1@nnrp1.deja.com>

Thanks so much everybody.  That's exactly what I needed.


Thanks again,
Michael


In article <slrn8tqfl7.2ce.mgjv@verbruggen.comdyn.com.au>,
  mgjv@tradingpost.com.au wrote:
> On Thu, 05 Oct 2000 19:27:15 -0700,
> 	Matthew Stoker <matt.stoker@motorola.com> wrote:
> > You can use:
> >
> > @files = <*.mp3>;
> >
> > or
> >
> > @files = glob *.mp3;
>
> You better make that
>
> @files = glob '*.mp3';
>
> if you want your program to compile.
>
> And I generally don't advocate the use of globbing, but recommend
> opendir and readdir instead [1]. On perl 5.6.0 and above that's less
> strong, but I still feel it's better to use system calls.
>
> Martien
>
> [1] I know you gave alternatives, but IMO they were not the right ones
> --
> Martien Verbruggen              |
> Interactive Media Division      | Freudian slip: when you say one
thing
> Commercial Dynamics Pty. Ltd.   | but mean your mother.
> NSW, Australia                  |
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 6 Oct 2000 09:09:44 -0400
From: "JP" <pangjo@hotmail.com>
Subject: Re: How to find IP address by MAC address?
Message-Id: <JakD5.12$PH2.88@client>

Thanks.


Chris Fedde <cfedde@u.i.sl3d.com> wrote in message
news:inTC5.137$D4.190387200@news.frii.net...
> In article <vkMC5.45$l51.534@client>, JP <pangjo@hotmail.com> wrote:
> >I am writing a Perl script which will check device status using SNMP
> >functions.  Since the IP addresses of the devices are dynamic, I would
like
> >to write the script based on the MAC or physical addresses.
> >
> >Can anyone tell me how I can convert an MAC address to IP using Perl?
> >
> >Thank you very much in advance.
> >
> >Joe
> >
>
> SNMP MIB includes an address translation table. You just need to
> get two columns out of it.  Ask your question in a group that has
> SNMP somewhere in its name.  Maybe someone there can give you the
> details.
>
> good luck
> chris
> --
>     This space intentionally left blank




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

Date: Fri, 06 Oct 2000 13:50:25 GMT
From: lynton@iname.com
Subject: How to make a table?
Message-Id: <8rklau$7ec$1@nnrp1.deja.com>

Whats the best way to make a table to hold name,age,sex,address for
several people? The data is in an SQL database but once its out for
processing in perl it needs to be held in memory.

I read about 'list of lists' but couldn't really understand how to
implement it (due to lack of examples). Are there any little scripts on
the web that show how to create a table?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 6 Oct 2000 10:13:08 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: How to make a table?
Message-Id: <Pine.A41.4.21.0010061011020.5020-100000@ginger.libs.uga.edu>

On Fri, 6 Oct 2000 lynton@iname.com wrote:

> Whats the best way to make a table to hold name,age,sex,address for
> several people? The data is in an SQL database but once its out for
> processing in perl it needs to be held in memory.
> 
> I read about 'list of lists' but couldn't really understand how to
> implement it (due to lack of examples). Are there any little scripts on
> the web that show how to create a table?

I suspect you want a list of hashes.  The following is from

    perldoc perldsc

and you'll find more explanations there.

LISTS OF HASHES
     Declaration of a LIST OF HASHES

      @LoH = (
             {
                 Lead     => "fred",
                 Friend   => "barney",
             },
             {
                 Lead     => "george",
                 Wife     => "jane",
                 Son      => "elroy",
             },
             {
                 Lead     => "homer",
                 Wife     => "marge",
                 Son      => "bart",
             }
       );




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

Date: Fri, 6 Oct 2000 11:04:16 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: how to unlink this file?
Message-Id: <Pine.LNX.4.21.0010061101360.12117-100000@hawk.ce.mediaone.net>

On Fri, 6 Oct 2000, Bart Lateur quoth:

BL> bing-du@tamu.edu wrote:
BL> 
BL> >I tried to use the following script to delete the
BL> >file
BL> >/usr/home/me/tmp/c24b18d4bb4afdf052330678af9a601d_attach_H:\tmp\zz.txt.
BL> >
BL> >===============
BL> >#!/usr/local/bin/perl
BL> >
BL> >$tmp = "/usr/home/me/tmp";
BL> >$uid = "c24b18d4bb4afdf052330678af9a601d";
BL> >
BL> >unlink("$tmp/$uid_attach_*") || die "file can not be deleted\n";
BL> >exit;
BL> >===============
BL> >
BL> >I got 'file can not be deleted'.
BL> 
BL> unlink() doesn't glob.

But you can pass a glob to it.

[anm@eagle ~/test] ls                                                   [pts/6]
[anm@eagle ~/test] touch 1 2 3                                          [pts/6]
[anm@eagle ~/test] ls                                                   [pts/6]
1  2  3
[anm@eagle ~/test] perl                                                 [pts/6]
unlink( <*> );
[anm@eagle ~/test] ls                                                   [pts/6]
[anm@eagle ~/test]                                                      [pts/6]

anm
-- 
perl -wMstrict -e '
$a=[[qw[J u s t]],[qw[A n o t h e r]],[qw[P e r l]],[qw[H a c k e r]]];$.++
;$@=$#$a;$$=[reverse sort map$#$_=>@$a]->[$|];for$](--$...$$){for$}($|..$@)
{$$[$]][$}]=$a->[$}][$]]}}$,=$";$\=$/;print map defined()?$_:$,,@$_ for @$;
'



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

Date: Fri, 6 Oct 2000 11:17:02 -0400
From: <rlwm@mindspring.com>
Subject: Re: Internet Website Survey Script
Message-Id: <8rkq5c$jo5$1@nntp9.atl.mindspring.net>

try http://www.resourceindex.com
Robin

beggar <oneof1121@hotmail.com> wrote in message
news:nudptsobmi0c9n73pd1av74c9qp6f0uvsl@4ax.com...
> Can someone recommend a survey script?




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

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


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