[10658] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4250 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 18 18:07:22 1998

Date: Wed, 18 Nov 98 15:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 18 Nov 1998     Volume: 8 Number: 4250

Today's topics:
        Activestate WIN32 Service Pack??? (Robert M Bellavance)
    Re: Beginner Book? <rkirch@SPAMOFF.torsel.alcatel.com>
        delete/modify DBM <c.clark@student.unsw.edu.au>
    Re: Help needed: How to redirect output from STDOUT int <rootbeer@teleport.com>
        hiding a URL (Gord Barentsen)
    Re: How to use "format" instruction into a loop ? (Charles DeRykus)
    Re: Log Munging <pkg@studbox.uni-stuttgart.de>
    Re: Log Munging <rootbeer@teleport.com>
    Re: Need equivalent to a sh's export command. (Tad McClellan)
        NT mailing & user <c.clark@student.unsw.edu.au>
    Re: Perl Usage Survey - interpretations, anyone? <uri@fastengines.com>
    Re: Perl Usage Survey - interpretations, anyone? <rootbeer@teleport.com>
    Re: Perl Usage Survey - interpretations, anyone? <fishbowl+news@netcomi.com>
    Re: Q: bulk-assign associative array? (Larry Rosler)
    Re: Q: bulk-assign associative array? <garethr@cre.canon.co.uk>
    Re: Q: bulk-assign associative array? (Larry Rosler)
    Re: Q: bulk-assign associative array? <uri@fastengines.com>
    Re: Q: bulk-assign associative array? <ebohlman@netcom.com>
    Re: Scope question for Perl <due@murray.fordham.edu>
    Re: selective list assignment? (Larry Rosler)
    Re: selective list assignment? <garethr@cre.canon.co.uk>
    Re: selective list assignment? (Andrew M. Langmead)
    Re: selective list assignment? (Tad McClellan)
    Re: selective list assignment? <ebohlman@netcom.com>
    Re: Smarter Web Mailer (Jonathan Bobin)
    Re: Sounds easy when I type it fast <zenin@bawdycaste.org>
    Re: User ID problem email@address.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 18 Nov 1998 19:41:14 GMT
From: bbell@hpcc01.corp.hp.com (Robert M Bellavance)
Subject: Activestate WIN32 Service Pack???
Message-Id: <243650014@hpcc01.corp.hp.com>

Ok, I took the bait and bought the Perl Resource Kit
for Win32. The current build of ActivePerl is now
at 507 an of you bought the PRK they tell you this:

"NOTE to Perl Resource Kit -- Win32 Edition users: 
If you have the Perl Resource Kit installed, then
you need the PRK Service Pack 1 to update ActivePerl.
Do not download and install the files below.
The PRK Service Pack 1 will be available in a day or two."

BULL*HIT!!!

This message has been there for two builds and over a week.
If you look at http://www.activestate.com/PRK/patches.htm the
service pack was due in mid October.

My question. Should I just forget about the PRK "rules" and grab the
507 build? I know this will probably mean I will have to install
modules, but it will mean that I don't have to just sit on my
hands and wait for something that may not happen.

You'd think Activestate would give the PRK users priority because
of the bucks we shelled out, but noooooo!!! What a rip off!



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

Date: Wed, 18 Nov 1998 15:43:53 -0500
From: "Richard Kirchknopf" <rkirch@SPAMOFF.torsel.alcatel.com>
Subject: Re: Beginner Book?
Message-Id: <72vb8h$dre@vu101.vansel.alcatel.com>

I am working my way through the "Perl 5 Interactive Course" from Waite Group
Press (now bought out by MCP I believe). ISBN 1-57169-113-8 (c) 1998.  So
far I
have found it very readable.  I am an experienced programmer so I don't know
if it
is perfect for pure novices. But I prefer a book that takes it nice and easy
with lots
of examples and I have found they explain things very well.  They don't use
programming keywords before they've explained how they work. For example,
they don't use $_ until you become comfortable with the whole concept
of variables prefixed with $.

The book also allows you access to their "e-zone", which contains an
internet
copy complete with quizzes on their web site.
Check out http://www.mcp.com/distance_learning/frame_ezone.html

Richard Kirchknopf
Alcatel Canada Inc. Transport Automation

Jeff Kennedy wrote in message <3650788e.14819289@news.newsguy.com>...
>I need a book geared to an ABSOLUTE BEGINNER!  No perl experience, no
>programming experience, no real shell scripting experience.





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

Date: Thu, 19 Nov 1998 08:30:20 +1100
From: Chris Clark <c.clark@student.unsw.edu.au>
Subject: delete/modify DBM
Message-Id: <36533C6C.D85DF56D@student.unsw.edu.au>


Hi people,

I am having trouble with DBMs, could anyone please assist?  (I can't use
the "Simple Database" as described in earlier postings as my data will
need to contain return characters which I think stuffs up ordinary text
file systems somewhat)...

I would like to be able to delete and modify a selected record in my DBM
file.  Here is the code I have to delete:

#*********
# deleteItem

sub deleteItem {

 $database = "mydbm.dbm";
 dbmopen (%contents, $database, 0700);
 $FORM{'newsitem'};
 delete $contents{$FORM{'newsitem'}};
 $message = "News item " . $FORM{'newsitem'} . "successfully deleted.";
 dbmclose %contents;


}

(I have also tried using the 'tie' function)....

and here is my code to Modify:

#*********
# updateNews

sub updateNews {


$database = "news.dbm";

 #open DBM file
 dbmopen (%contents, $database, 0700);

 $heading = $FORM{'heading'};
 $summary = $FORM{'summary'};
 $article = $FORM{'article'};

 $contents{$FORM{'newsitem'}} =
"${date}|${heading}|${summary}|${article}";

 dbmclose %contents;


}


can anyone suggest what I am doing wrong, and what how I can fix it up?

tia.

Chris Clark.



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

Date: Wed, 18 Nov 1998 22:00:09 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help needed: How to redirect output from STDOUT into list?
Message-Id: <Pine.GSO.4.02A.9811181357370.27321-100000@user2.teleport.com>

On Wed, 18 Nov 1998, Ron wrote:

> Can I tie to STDOUT without strange behavior?

Well... what do you mean by "strange behavior"? Maybe you can do what you
want by tie()ing OTHER_FH, then select()ing that as the default before you
call the subroutines. Then you can restore the original default when you
return. But if you need to, you could tie() STDOUT, then have your program
send output to REAL_STDOUT; see open()'s entry in the perlfunc manpage
about duping standard file descriptors. Good luck!

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



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

Date: Wed, 18 Nov 1998 21:33:16 GMT
From: gpb@ppaolucci.com (Gord Barentsen)
Subject: hiding a URL
Message-Id: <36533c9e.23989692@news.the-wire.com>


	Hello...I'm not sure if this is a Perl-specific question, but
I thought maybe it could be accomplished within a Perl CGI script.  Is
there any way to cause the browser to hide the URL of a
(protected/secure) web page, thus causing the browser NOT to display
it in the LOCATION field?  Or at least to scramble/encrypt it so that
it could not be bookmarked/copied?  Thanks in advance for any help
anyone could give me!

Gord Barentsen




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

Date: Wed, 18 Nov 1998 22:20:35 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: How to use "format" instruction into a loop ?
Message-Id: <F2n22B.24M@news.boeing.com>

In article <3652A0B3.2DE8@wanadoo.fr>, Serge  <klootch@wanadoo.fr> wrote:
>
>      foreach $value (keys %FORM) {
>         # Print the name and value pairs in FORM array to html.
>            print MAIL "$value: $FORM{$value}\n\n";
>
>May i use "format" instruction ?
>How I can insert it in the loop ?
>to get something like:
>
>Name     :                Value
>Naaaaame :                Val
>nam      :                Vaaaaaallllluuueee
>
>

probably easier to just C<printf>, e.g., 

my $max  = 0;
for (keys %FORM) { my $size = length; $max = $size if $size >= $max }
while ( (my $key,my $value) = each %FORM ) {
   printf "%-${max}s :\t%s\n", $key,$value; 
}

hth,
--
Charles DeRykus


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

Date: Wed, 18 Nov 1998 22:38:56 +0100
From: Peter Gilbert <pkg@studbox.uni-stuttgart.de>
Subject: Re: Log Munging
Message-Id: <36533E70.BED58E5C@studbox.uni-stuttgart.de>

Ci-Ci Mills wrote:

*snip*

> This is how I am populating the hash:
> 
> if ($url =~ m|.*?query\=?(.*?)\&|) {
>   $keyhash{$dt} = $1 unless (($keyhash{$dt}) || ($1 eq ""));
>   $keyhash{$dt}{$1} = $keyhash{$dt}{$1} + 1;
> }

# I suggest:   $keyhash{dt}{$1}++;  :)

> 
> This is how I am printing out the hash:
> 
> foreach $datetime (sort keys %keyhash) {
>     print "$datetime\n";
>     foreach $wd (sort keys %{$keyhash{$datetime}}) {
>        print "$title\t$keyhash{$datetime}{$wd}\n";
>     }
> }

foreach $wd ((sort {$keyhash{$datetime}{$a} <=>
$keyhash{$datetime}{$b};}
    keys %{keyhash{$datetime})[0..19])
{
print "whatever: $keyhash{$datetime}{$wd}\n";
} #end foreach

I haven't tested it or anything, but the basic idea is sort by a
function that compares whats in the hash instead of the key string.

hopes this helps


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

Date: Wed, 18 Nov 1998 22:02:41 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Log Munging
Message-Id: <Pine.GSO.4.02A.9811181401250.27321-100000@user2.teleport.com>

On Wed, 18 Nov 1998, Ci-Ci Mills wrote:

> I need to sort by the count....this is where I am
> running into problems.

There is good info about sorting in the perlfunc manpage, and in the FAQ.
Hope this helps!

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



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

Date: Wed, 18 Nov 1998 16:34:00 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Need equivalent to a sh's export command.
Message-Id: <o0iv27.0jd.ln@flash.net>

Thomas Jordan (*ace*@programmer.net) wrote:

: How do you modify the parent shell's environment?


   You don't.


   Perl FAQ, part 8:

      "I {changed directory, modified my environment} in a perl script.  
       How come the change disappeared when I exited the script?  
       How do I get my changes to be visible?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 19 Nov 1998 08:32:25 +1100
From: Chris Clark <c.clark@student.unsw.edu.au>
Subject: NT mailing & user
Message-Id: <36533CE9.18ABCC9E@student.unsw.edu.au>

Hi,

I would like to know two things:

1.  how do you do a Formmail type program from NT (is it different, or
the same).

2. how can you detect the NT username of a person using your Intranet
website??

any help/links much appreciated.


- Chris Clark.



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

Date: 18 Nov 1998 16:16:50 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Perl Usage Survey - interpretations, anyone?
Message-Id: <sark90sd7lo.fsf@camel.fastserv.com>

>>>>> "AT" == Adam Turoff <ziggy@panix.com> writes:

  AT> In article <sarbtm4epkj.fsf@camel.fastserv.com>,
  AT> Uri Guttman  <uri@sysarch.com> wrote:

  >> seeing randal's and tom's bios babelfished from german is amusing. but i
  >> am missing your point regarding sun. babelfish and altavista are on
  >> alphas, IIR since they are both (nee) dec.

  AT> elaine, could you please tell uri he's being too literal again?

you can tell me yourself. stop hiding behind elaine's skirts!
and in my world 'sun' ne 'compaq'.

  AT> Go read the translation bit until you get the 'good tool' joke.
  AT> And if altavista, et al are running AIX, BeOS, Coherent or
  AT> DecUnix, it doesn't really matter.  As you put it, 'sun users know
  AT> a good tool when they see one', and IMNSHO babelfish qualifies as
  AT> a good tool when you need a good laugh.

  AT> methinks you need a nice big cup of coffee before you get back to work
  AT> on perl2cobol...

i almost have it finished:

perl -pe 'open STDOUT, ">&/dev/null"' foo.pl

will generate high quality cobol.

and i don't like coffee.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Wed, 18 Nov 1998 22:03:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Usage Survey - interpretations, anyone?
Message-Id: <Pine.GSO.4.02A.9811181403260.27321-100000@user2.teleport.com>

On Wed, 18 Nov 1998, John Porter wrote:

> Actually, there seems to be some speculation among anthropologists
> lately that the neanderthals may have indeed been more intelligent
> than the sapiens who displaced them.  Wish I had a link or two for you...

Ah, the missing link, no doubt.

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



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

Date: 18 Nov 1998 22:44:39 GMT
From: James <fishbowl+news@netcomi.com>
Subject: Re: Perl Usage Survey - interpretations, anyone?
Message-Id: <72vikn$2aj@sjx-ixn3.ix.netcom.com>

In article <72t423$42v@panix.com>, Adam Turoff <ziggy@panix.com> wrote:
>>problems with whatever they use in that case. there ain't no easy way to
>>have true 24x7 without someone on the physical premises. someone has to
>>hit the power button!
>
>There are a few simple answers to that, but they're not failsafe.

Having the 24x7 staff is not failsafe either.  
The bitter sysadmin syndrome pervades the industry.
The job market is soft.  

>And there's no way a mom&pop who just want to get their job done would 
>know the first thing about accidentally acting as an anonomous sendmail
>redirector because their incompetant admin is overcharging them and playing
>doom when he's not answering their calls on the red phone.

Maybe they're 'underpaying' then?  Are you implying that somebody more
expensive, such as (ahem, http://www.conservatory.com/resume.public.html)
*me*, might do a better job for them, playing nethack instead of doom, and
answering the cell phone *every* time, solving the problem *the first time*
(every time), and not setting up the open relay in the first place?


>Sounds like a new class of ISP service - connectivity and such, no questions
>asked; lease the server and pay the monthly bandwidth bill and we'll take
>care of the rest.  

That's not a new class of ISP service.  I leased exactly that from ANSnet 
between 1993 and 1995, for the purpose of running an ISP (~3000 dialups).
And I was repeatedly impressed:  Very often, ANS admins would page me explaining
the problem before I even noticed what was down.
-- 
James
http://ssdd.conservatory.com


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

Date: Wed, 18 Nov 1998 12:56:34 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q: bulk-assign associative array?
Message-Id: <MPG.10bcd4583f106b1698987e@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <sar3e7geoki.fsf@camel.fastserv.com> on 18 Nov 1998 15:25:01 
-0500, Uri Guttman <uri@fastengines.com> says...
 ..
> @arr{ 'a', 'b', 'c' } = ( 1, 2, 4 );

or (quoteless):

  @arr{ qw( a b c ) } = ( 1, 2, 4 );

or (assuming he may go past 'c' IRL):

  @arr{ 'a' .. 'c' } = ( 1, 2, 4 );

> 
> or
> 
> %arr = ( 'a' => 1, 'b', => 2, 'c' => 4 ) ;
                        ^ ???

I know you like to quote things explicitly, but this is made-to-order 
not to:
 
  %arr = ( a => 1, b => 2, c => 4 ) ;

> 
>   A> print "arr2{\"a\"}:".$arr2{"a"}."\n"; # print value
> 
> my eyes are burning from the quotes!  have you read about all the variety
> of quotes in perl? you almost never have to backwhack a quote char. just
> pick a different outside quote. you don't even seem to know about single
> quote (') which is more what you want as a key inside a hash.
> 
>   A> print "arr2{'a'}: $arr2{'a'}\n" ; 
> 
> no need for . and multiple strings and \" etc. just do it directly as
> one nice and easy to read string.

My eyes are burning from the quotes!

    A> print "arr2{a}: $arr2{a}\n" ; 

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


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

Date: Wed, 18 Nov 1998 21:34:34 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Q: bulk-assign associative array?
Message-Id: <siiugcsn11.fsf@cre.canon.co.uk>

Larry Rosler <lr@hpl.hp.com> wrote:
> I know you like to quote things explicitly, but this is made-to-order 
> not to:
>  
>   %arr = ( a => 1, b => 2, c => 4 ) ;

If you habitually run Perl with -w, then you may later be stung when
some module you're using defines a function called 'a':

  Ambiguous use of a => resolved to "a" => at ...

-- 
Gareth Rees


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

Date: Wed, 18 Nov 1998 13:59:29 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q: bulk-assign associative array?
Message-Id: <MPG.10bce31ba8255892989880@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <siiugcsn11.fsf@cre.canon.co.uk> on Wed, 18 Nov 1998 21:34:34 
GMT, Gareth Rees <garethr@cre.canon.co.uk> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> > I know you like to quote things explicitly, but this is made-to-order 
> > not to:
> >  
> >   %arr = ( a => 1, b => 2, c => 4 ) ;
> 
> If you habitually run Perl with -w, then you may later be stung when
> some module you're using defines a function called 'a':
> 
>   Ambiguous use of a => resolved to "a" => at ...

Or for the existing functions 'm', 's', and 'y'.  But fortunately this 
warning has gone away in 5.005.

As I have to use older versions also, I tend to start these unquoted 
keys with a capital letter, which is guaranteed not to conflict with the 
name of a built-in function.

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


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

Date: 18 Nov 1998 17:16:24 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Q: bulk-assign associative array?
Message-Id: <sarhfvwd4uf.fsf@camel.fastserv.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  >> 
  >> If you habitually run Perl with -w, then you may later be stung when
  >> some module you're using defines a function called 'a':
  >> 
  >> Ambiguous use of a => resolved to "a" => at ...

  LR> As I have to use older versions also, I tend to start these unquoted 
  LR> keys with a capital letter, which is guaranteed not to conflict with the 
  LR> name of a built-in function.

larry,

	just quote them! no ambiguity, no conflicts, and visual
	highlighting.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Wed, 18 Nov 1998 22:37:53 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Q: bulk-assign associative array?
Message-Id: <ebohlmanF2n2v6.1uC@netcom.com>

droby@copyright.com wrote:
: and it will work.  A more suggestive way (by "syntactic sugar") is

: 	%arr2 = ('a' => 1, 'b' => 2, 'b' => 3);

Part of the syntactic sugar content of '=>' is automatically quoting the 
word before it, so you can omit the single quotes in your example.



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

Date: 18 Nov 1998 22:56:29 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Scope question for Perl
Message-Id: <72vjat$b5d$0@206.165.167.236>

Please ignore this post.  It was a long day and my wiring seems loose.

John Porter wrote in message <365323FD.EAF97B1E@min.net>...

[snip of all the relevent, meaningful information]

>Get used to declaring all your variables with 'my', and you should be
>happy.


Finally, the seemingly endless search for the source of deep, genuine,
lasting happiness is at an end.  The truth is revealed!  No more
psychotherapy, no more gurus, no more self-help books, no more religious
retreats, no more beating of breasts and gnashing of  teeth.  In then end,
like all fundamental truths, the path to happiness can be summed up in one
simple word: my.

I tremble in the epiphany.

AmD

Feeling just to damn weird today.





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

Date: Wed, 18 Nov 1998 13:21:07 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: selective list assignment?
Message-Id: <MPG.10bcda1e24e5011998987f@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <36532FB7.7AC69D9C@catnmoose.com> on Wed, 18 Nov 1998 
15:36:07 -0500, Marty Landman <marty@catnmoose.com> says...
> I want a 'pretty' way to assign selective variables from a list, i.e. I
> want to code the equivalent of
> 
> ($not1,$not2,$not3,$hh,$mm,$ss,$zz) = `date`;
> 
> where the first three elements are not needed... is there a better way
> to indicate in one stmt that I'm not interested in the first 3 elmts of
> the array?

There are at least two prettier ways:

  (undef,undef,undef,$hh,$mm,$ss,$zz) = `date`;

or (better, IMO), use an array slice:

  ($hh,$mm,$ss,$zz) = (`date`)[3 .. 6];

But in list context, `date` returns an array of one element, which is a 
string.  So the 'correct' way is:

  ($hh,$mm,$ss,$zz) = (split /[: ]/, `date`)[3 .. 6];

If you don't need the timezone name, it is better to use 'localtime' 
(for efficiency, and because `date` isn't portable).

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


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

Date: Wed, 18 Nov 1998 21:30:49 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: selective list assignment?
Message-Id: <sik90ssn7a.fsf@cre.canon.co.uk>

Marty Landman <marty@catnmoose.com> wrote:
> I want a 'pretty' way to assign selective variables from a list, i.e. I
> want to code the equivalent of
> 
> ($not1,$not2,$not3,$hh,$mm,$ss,$zz) = `date`;
> 
> where the first three elements are not needed... is there a better way
> to indicate in one stmt that I'm not interested in the first 3 elmts of
> the array?

Use a slice on the output of 'localtime':

  my ($day,$month,$year) = (localtime)[3,4,5];

(I presume you meant to write 'localtime' rather than `date`, since
`date` returns a single string, not a list.)

-- 
Gareth Rees


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

Date: Wed, 18 Nov 1998 21:48:52 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: selective list assignment?
Message-Id: <F2n0LH.E2K@world.std.com>

Marty Landman <marty@catnmoose.com> writes:

>I want a 'pretty' way to assign selective variables from a list, i.e. I
>want to code the equivalent of

>($not1,$not2,$not3,$hh,$mm,$ss,$zz) = `date`;

You can use subscripts  to retrieve specific elements from list.

($hh, $mm, $ss, $zz) = (split /[\s:]/, `date`)[3,4,5];

"()" is a list construct. The backticks and the split get executed and
fill the list. The "[]" extract the specified elements from the list
and then the "=" assigns them to the variables.

Although in this case, you might be better off using localtime()
instead of running "date". (Same example of list slice notation, it
just doens't fork off another process)

use POSIX;
($hh, $mm, $ss, $daylight) = (localtime)[2,1,0,8];
$zz = (POSIX::tzname)[$daylight];
print "$hh $mm $ss $zz\n";
-- 
Andrew Langmead


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

Date: Wed, 18 Nov 1998 16:40:05 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: selective list assignment?
Message-Id: <5civ27.bmd.ln@flash.net>

Marty Landman (marty@catnmoose.com) wrote:
: I want a 'pretty' way to assign selective variables from a list, i.e. I
: want to code the equivalent of

: ($not1,$not2,$not3,$hh,$mm,$ss,$zz) = `date`;

: where the first three elements are not needed... is there a better way
: to indicate in one stmt that I'm not interested in the first 3 elmts of
: the array?


   (undef,undef,undef,$hh,$mm,$ss,$zz) = `date`;


   You might take an array slice of the RHS instead, but
   I cannot demonstrate that because `date` returns a
   one-element list on my system...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 18 Nov 1998 22:39:37 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: selective list assignment?
Message-Id: <ebohlmanF2n2y1.1y2@netcom.com>

Marty Landman <marty@catnmoose.com> wrote:
: I want a 'pretty' way to assign selective variables from a list, i.e. I
: want to code the equivalent of

: ($not1,$not2,$not3,$hh,$mm,$ss,$zz) = `date`;

: where the first three elements are not needed... is there a better way
: to indicate in one stmt that I'm not interested in the first 3 elmts of
: the array?

If you're using a recent Perl, just use 'undef' (without the quotes, of 
course) in the positions where you don't care about the return value.



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

Date: 18 Nov 1998 21:34:37 GMT
From: jonathan@core.dumped.org (Jonathan Bobin)
Subject: Re: Smarter Web Mailer
Message-Id: <slrn756fu6.e9.jonathan@core.dumped.org>

In article <365215B2.625E@courrier.usherb.ca>, JTJ wrote:
>I am playing with a Web-Based E-mailer. How do I extract a web address
>in a block of text and replace it with a link:
>
>I would use a substitution string:
>
>$message =~ s/???/???/g;
>
>Something like??
>
>	$message =~ s/http:\/\/\s*(\w+|$)/????/go;

Try something like:
	$message =~ s/(http\:\S+)\s/\<a href\=\"$1\"\>$1\<\/a\>/g;

It's very basic and not foolproof, but it should work :)

--
Jonathan Bobin                             Dumped Communications
jonathan@xnet.org                      http://moocat.home.ml.org
What UNIVERSE is this, please??


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

Date: 18 Nov 1998 22:17:42 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Sounds easy when I type it fast
Message-Id: <911427262.23566@thrush.omix.com>

Jenny Brandis <brandis@benet.net.au> wrote:
: I know nothing about programming but would like to make my site
: interactive with a searchable database and maybe get some user stats.
:
: Sounds easy when I type it fast. <g>

	Yep, and it sounds like you need a programmer.

: I have asked my ISP what is available in his cgi-bin and was told I
: should have my own. So I downloaded STABLE.ZIP to my hard drive.

	What is stable.zip?  Are you referring to the stable perl release?
	If so, you'll need to do more then just download it.  See the
	README file.

: I made a directory called cgi-bin on my ISP server, above my public
: directory as he told me.

	Good.

: Downloaded a couple of scripts that sound ok. (Matt's simple search,
: urlsrch.cgi, websearch and intermediate search.)

	Bad.  Don't trust anything from Matt's Script Archive unless you're
	a competent programmer and have fully gone over every line of his
	code.  Many (most/all?) of his work is unstable at best.

	I don't know about the other scripts/programs.

: But now what? I guess I need to upload the (unzipped) stable.zip to my
: cgi-bin, but do I need all those files? Or just some that run the bits I
: want?

	Er, huh?  If stable.zip is perl, you'll need it all.  *HOWEVER*, it
	should *NOT* be in your cgi-bin.  This is a major security risk.

	Actually, your ISP should already have it installed.  Normally it
	is located at /usr/local/bin/perl

: Is it true that with cgi I can't test drive it on my computer like I do
: HTML?

	Yes and no.  You need an actual web server to run CGI programs,
	however there are a few options.

	1 (best): Run a web server on your computer.  I'd recommend Apache
	(www.apache.org), as it not only is the best out there, it's also
	free and has a beta out for Win32 (NT & Windows 95) systems.

	2 (ok): If your CGI programs are in Perl, you can install perl on
	your local machine and do some testing from the command line
	(though not through a browser).

: I guess I should have mentioned that I live in a very small town and to
: the best of my knowledge there is no one who can guide me in this. Even
: the school teachers are 'out of their area of expertise'.

	Pick up a couple good books on CGI programming and Perl.

	Hint: Pretty much anything published in the last 8 years from Sams,
	MacMillan(sp?), Que, etc is complete trash.  Look for books by
	O'Reilly & Associates.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 18 Nov 1998 21:25:28 GMT
From: email@address.com
Subject: Re: User ID problem
Message-Id: <36533a19.53425227@news-server.amherst.edu>

On Wed, 18 Nov 1998 11:03:04 -0500, james_peregrino@harvard.edu (James
Peregrino) wrote:

>Try this (B) Have the registration program create the survey page too.
>Pass the ID as a hidden field.

That is what I ended up doing. I kept the seperate HTML files--I just
had the registration CGI open and print the contents of the survy HTML
file, inserting the hidden ID field as it writes. Perhaps it isn't the
most efficient way to do things, but it works.

> James Peregrino                                 (617)496-6288 (v)
> Manager of Comp. Services                       (617)495-5685 (f)
> Harvard Div. Cont. Ed.
> james_peregrino@harvard.edu

Thanks James.

GJB



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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4250
**************************************

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