[7998] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1623 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 12 16:07:27 1998

Date: Mon, 12 Jan 98 13:00:24 -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           Mon, 12 Jan 1998     Volume: 8 Number: 1623

Today's topics:
     Re: $2 and $3 are unreliably unset? <*@qz.to>
     Re: **1A Please Help, Perl is harrassing me ** (brian d foy)
     Re: alphabetical subset of hash keys (Tad McClellan)
     Re: alphabetical subset of hash keys (Greg Bacon)
     Re: Avoiding regular expressions (was: Re: Newbie quest (brian d foy)
     binmode (FILEHANDLE); ## on win32/NT (Eric)
     Re: bison for perl <jay@rgrs.com>
     Dereferencing, Hashes, and Keys (Raymon Jones)
     Re: Dereferencing, Hashes, and Keys (brian d foy)
     Enumerate directories <johnfitz@cnct.com>
     Giving a cookie a new date <svetter@ameritech.net>
     Re: Giving a cookie a new date (brian d foy)
     Re: Giving a cookie a new date (Mike Stok)
     Help with Win32::Process::Create djboyd@sam.on-net.net
     Re: HELP!!!!!!!! (brian d foy)
     Re: MacPerl: diagnosing "Out of Memory!" (Chris Nandor)
     newbie Q: N of operations (Srdan Simunovic)
     Re: newbie Q: N of operations (Mike Stok)
     Re: newbie Q: N of operations tobez@plab.ku.dk
     Re: Perl Email Ques!! Thanks for Help! 8-) (brian d foy)
     Re: perl under windows95 <cmbaker@fedex.com>
     Re: Search engine? Do u? (brian d foy)
     Sys::Syslog problems. (Jeremy Madea)
     Testing for valid numeric values <gspirit@flash.net>
     Re: Testing for valid numeric values (brian d foy)
     Re: Testing for valid numeric values <che@debian.org>
     Re: Testing for valid numeric values (Matthew Cravit)
     Re: What does qw mean? <camerond@mail.uca.edu>
     Re: WHY DOES THIS FAIL? (Matthew Barbour)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Jan 1998 19:19:14 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: $2 and $3 are unreliably unset?
Message-Id: <qz$9801121409@qz.little-neck.ny.us>

Mike Giroux  <mgiroux@icon.com> wrote:
> A co-worker asked me if $2 and $3 get unset if a later s// only has one
> set of ().  I thought so, but I decided to test it.  That works properly,
> but what doesn't seem to work reliably is preservation of $1, $2, and $3
> when a match _fails_.  From this test case, it looks like the values get
> preserved across one failed match, but not always across the second, and
> this only in a while loop.  Is there an easy explanation for this??

>From perlre:

       When the bracketing construct ( ... ) is used, \<digit> matches the
       ...
       The scope of $<digit> (and $`, $&, and $') extends to the end of the
       enclosing BLOCK or eval string, or to the next successful pattern
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       match, whichever comes first.
       ^^^^^

You have just observed that variables are intermitantly accessible
out of scope. Read the source to find out why, but don't rely upon
that behavior.

Elijah
------
better to use "($one, $two, $three) = /(.)(.)(.)/" and not rely on them at all


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

Date: Mon, 12 Jan 1998 14:06:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: **1A Please Help, Perl is harrassing me **
Message-Id: <comdog-ya02408000R1201981406100001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34B9905F.57628591@coos.dartmouth.edu>, rjk@coos.dartmouth.edu posted:

>brian d foy wrote:
>> 
>> try
>> 
>>    s/@/\@/g;
>> 
>> but it's likely to behave in ways that you don't expect.

or in ways that i don't expect.  oy.

-- 
brian d foy                                  <comdog@computerdog.com>


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

Date: Mon, 12 Jan 1998 12:53:48 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: alphabetical subset of hash keys
Message-Id: <srod96.q23.ln@localhost>

John Capell (jcapellSpamMeNot@mindspring.com) wrote:
: If I have a large hash, how can I run a routine on just the keys that
: start with a certain letter? I want something that looks like:

:     foreach $key (keysthatstartwithA %myhash) {
:         print "$myhash{$key}\n";
:     }


     foreach $key (grep /^A/, keys %myhash) {
         print "$myhash{$key}\n";
     }


But that still "bangs through every key in the hash", it's just
that grep() does the banging for you...


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


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

Date: 12 Jan 1998 19:20:37 GMT
From: gbacon@adtran.com (Greg Bacon)
Subject: Re: alphabetical subset of hash keys
Message-Id: <69dqe5$t0v$1@info.uah.edu>

In article <34ba4d7e.7380826@news.mindspring.com>,
	jcapellSpamMeNot@mindspring.com (John Capell) writes:
: If I have a large hash, how can I run a routine on just the keys that
: start with a certain letter?
[snip]
:     foreach $key (keys %myhash) {
:         if ( substr($key,0,1)=="A" ) { print "$myhash{$key}\n" };
:     }
: 
: but without having to bang through every key in the hash to see if it
: starts with 'A' (that just seems inefficient to me)

In terms of efficiency, unpack is probably a better choice than substr,
e.g.

    foreach $key (keys %hash) {
        ## use the eq (not ==) operator for string comparison
        ##                            VV
        next unless unpack("A", $key) eq "A";

        ...;
    }

Still, this is a microoptimization, and not likely to produce huge
savings (unless you're dealing with very large hashes in terms of the
number of keys).  Greater efficiency will probably come from a change
in your general approach to your data (read: algorithm).

: BTW - this hash is tied to a BTREE Berkely DB, so the hash keys will
: be returned in alphabetical order. What I'm trying to do is allow the
: user to 'query' the database by letter.

I don't know what you're using these data for, but would it help to
organize your data into separate hashes (say, a hash for each letter
of the alphabet)?

:   John L Capell    (remove "SpamMeNot" from reply-to eMail)

To receive email replies, put a replyable address in your Reply-To:
header. :-)

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Mon, 12 Jan 1998 14:11:15 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Avoiding regular expressions (was: Re: Newbie question)
Message-Id: <comdog-ya02408000R1201981411150001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34B93487.755621F4@coos.dartmouth.edu>, rjk@coos.dartmouth.edu posted:

>John C. Randolph wrote:
>> 
>> No, there are definitely people who shouldn't be using Perl *or* Python, *or*
>> anything other than the first language they learned  (Visual Basic: it causes
>> severe brain damage, just like all previous versions of Basic did.)
>
>Excuse me, but the first programming language I learned was BASIC.

i've found BASIC to be very useful, but then i don't advocate religious
views about any language.  i'd drop Perl in a second if something better
came along (although i don't see that happening right away).

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 12 Jan 1998 20:53:07 GMT
From: pojo@gte.net (Eric)
Subject: binmode (FILEHANDLE); ## on win32/NT
Message-Id: <69dvh3$s15$1@gte2.gte.net>

Okay,

	I know the binmode thing seems to have been beaten to death,
but I can't find anything on dejanews that answers my question.  Code:

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

$a = "this is a\ntest";  ## 14 bytes

open (NEWFILE, ">test");
binmode NEWFILE; ## returns 1 (true)

syswrite(NEWFILE,$a,len($a))  ## Returns 14

sysseek(NEWFILE,0,0); ## returns 0

sysread(NEWFILE,$a,14); # xlates it back from 15 to 14 bytes


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

Unfortunately, 15 bytes (not 14) are written to the file because the
\n is expanded to \r\n.  It's also un-expanded using a sysread(), or
even a read() ...

Since I'm trying to do fixed-length record updates, this tends to
overwrite other records =(

This is perl, version 5.004_02
Gurusamy Sarathy port.




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

Date: 12 Jan 1998 15:08:45 -0500
From: Jay Rogers <jay@rgrs.com>
To: Richard Jelinek <rj@suse.de>
Subject: Re: bison for perl
Message-Id: <82hg79cv5e.fsf@shell2.shore.net>

Richard Jelinek <rj@suse.de> writes:
> I'm looking for a parser generator for perl.

I've had success with the module Parse::RecDescent.  You can find it
at a CPAN site near you.

--
Jay Rogers
jay@rgrs.com


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

Date: 12 Jan 1998 19:35:12 GMT
From: rkjones@fas.harvard.edu (Raymon Jones)
Subject: Dereferencing, Hashes, and Keys
Message-Id: <69dr9g$hej$1@news.fas.harvard.edu>

Cheers,

I have a quick question regarding dereferencing and hashes.

I am currently passing an argument to a function that is a reference to a
hash.  Let's call the function TestFunction, so the code would look
something like this:

my (
	%testhash,
);

$testhash{foo} = "foobar";

&TestFunction(\%testhash);

sub TestFunction {

	foreach $value (keys $$_[0]) {
		print "Howdy!\n";
	}
}

Well, the Perl compiler gives me an error, informing me that the argument
to keys has to be a hash, and not a scalar dereference.

My question is twofold:

1. How can I get around this problem?

2. Supposing that I can't get around this problem, how should I create a
variable local to the function TestFunction that is essentially a copy of
the hash passed as an argument? i. e. if TestFunction had a my(
%testhash2) in it, how could I get %testhash2 to contain all the values of
%testhash . . . in other words, is it possible to dereference the entire
hash that was passed as an argument, and poke all of the values and keys
into %testhash2?

If you could, I would certainly prefer email to follow-up postings, but
will be more than happy to accept any information that you give.

Kyle


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

Date: Mon, 12 Jan 1998 15:17:41 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Dereferencing, Hashes, and Keys
Message-Id: <comdog-ya02408000R1201981517410001@news.panix.com>
Keywords: from just another new york perl hacker

In article <69dr9g$hej$1@news.fas.harvard.edu>, rkjones@fas.harvard.edu (Raymon Jones) posted:



>&TestFunction(\%testhash);
>
>sub TestFunction {
>
>        foreach $value (keys $$_[0]) {
>                print "Howdy!\n";
>        }
>}

>Well, the Perl compiler gives me an error, informing me that the argument
>to keys has to be a hash, and not a scalar dereference.

well, it has to be a hash, so dereference it as one:

   my $hash_ref = shift;

   foreach( keys %$hash_ref) { ... };

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 12 Jan 1998 15:39:10 EST
From: John Fitzpatrick <johnfitz@cnct.com>
Subject: Enumerate directories
Message-Id: <VA.00000010.0149ae09@nycb068132f>

Hi.

In perl, on NT, I wish to enumerate every subdirectory under a 
specified directory, and put them in an array.  Or perhaps there is 
some switch to the foreach command that allows me to do this?

(For those familiar with the FOR command on NT, I want to do the same 
thing that FOR /D does.)

John



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

Date: Mon, 12 Jan 1998 14:06:23 -0500
From: Scott Vetter <svetter@ameritech.net>
Subject: Giving a cookie a new date
Message-Id: <34BA69AE.10A5@ameritech.net>

How can a Perl program give the user a cookie but using something
other than the current date, say something like a year from the current?


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

Date: Mon, 12 Jan 1998 14:26:00 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Giving a cookie a new date
Message-Id: <comdog-ya02408000R1201981426000001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34BA69AE.10A5@ameritech.net>, svetter@ameritech.net posted:

>How can a Perl program give the user a cookie but using something
>other than the current date, say something like a year from the current?

a perl program does it the same way a program written in another
language would.  if you are using CGI.pm, see the documentation for
setting cookie parameters.

your question is also answered by the resources in the CGI Meta FAQ.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 12 Jan 1998 14:15:35 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Giving a cookie a new date
Message-Id: <69dq4n$1e5$1@stok.co.uk>

In article <34BA69AE.10A5@ameritech.net>,
Scott Vetter  <svetter@ameritech.net> wrote:
>How can a Perl program give the user a cookie but using something
>other than the current date, say something like a year from the current?


If you're using perl 5.xxx then you should look at the CGI module.  Its
documentation includes:

       The -cookie parameter generates a header that tells the
       browser to provide a "magic cookie" during all subsequent
       transactions with your script.  Netscape cookies have a
       special format that includes interesting attributes such
       as expiration time.  Use the cookie() method to create and
       retrieve session cookies.

        [...]

       The interface to Netscape cookies is the cookie() method:

           $cookie = $query->cookie(-name=>'sessionID',
                                    -value=>'xyzzy',
                                    -expires=>'+1h',
                                    -path=>'/cgi-bin/database',
                                    -domain=>'.capricorn.org',
                                    -secure=>1);
           print $query->header(-cookie=>$cookie);

       cookie() creates a new cookie.  Its parameters include:

       -name
           The name of the cookie (required).  This can be any
           string at all.  Although Netscape limits its cookie
           names to non-whitespace alphanumeric characters,
           CGI.pm removes this restriction by escaping and
           unescaping cookies behind the scenes.

       -value
           The value of the cookie.  This can be any scalar
           value, array reference, or even associative array
           reference.  For example, you can store an entire
           associative array into a cookie this way:

                   $cookie=$query->cookie(-name=>'family information',
                                          -value=>\%childrens_ages);


       -path
           The optional partial path for which this cookie will
           be valid, as described above.

       -domain
           The optional partial domain for which this cookie will
           be valid, as described above.

       -expires
           The optional expiration date for this cookie.  The
           format is as described in the section on the header()
           method:

                   "+1h"  one hour from now


       -secure
           If set to true, this cookie will only be used within a
           secure SSL session.

If you have an old perl 5 you may have to get the CGI module from a
Comprehensive Perl Archive Network (CPAN) site, or upgrade to 5.004_04 if
possible as CGI is now part of the standard release.  CPAN sites can be
found by visiting http://www.perl.com and following likely looking links
or by ftp to ftp.funet.fi and looking under /pub/languages/perl/CPAN
(there are mirror sites which may be closer to you in net terms.)

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Mon, 12 Jan 1998 20:05:31 GMT
From: djboyd@sam.on-net.net
Subject: Help with Win32::Process::Create
Message-Id: <34ba747e.11199762@news.on-net.net>

Hardware:

IBM PC 200MHz with 64MG Ram 
Windows NT 4.0 workstation using Novell 3.11 client
Perl 5 for NT


I have a script which will attach to a pair of servers, create a
directory tree of each of the servers (source - target), run a diff
and then create a report.

In the beginning I would run this in a seq. manner for 20 server
pairs.  The whole process would take a weekend to do it due to the LAN
and WAN that is being used.  Now, to speed up the process I wanted to
use the Win32::Process::Create to run up to 4 process at once.

Now the structure of this app is the following:

There is a main driver, which will kick off 4 sub driver process.
Each of these sub driver process, in turn, will create a process it
self to run a script called ntcompare.pl (that is all 4 sub drivers
use the same script that does all the work).  These sub drivers get
there source-target pair from a servers.txt file that is shared (this
is done using semiphores.  Now I am kicking off all of the process
using the following code:

  Win32::Process::Create(
	   $FirstProcessObj,
	   $program,
	   $arg_1,
	   0,
	   CREATE_NEW_CONSOLE,
	   ".") || warn &RptError("WARNING - Cannot create First
process\n    $!");


Now the question is, should I be using Create_New_Console or something
else since each of the 4 sub driver process use the same script?

The reason this is comming up is that if I run this app with only a
single source-target pair, I have no problems with the data.  When I
run it with a group of source-target severs, the resulting directory
tree info files are smaller and some of the stats of a given file are
incorrect, i.e. size = 0 and date of 12/31/69.

Any help.
 ...
TIA


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

Date: Mon, 12 Jan 1998 14:04:44 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: HELP!!!!!!!!
Message-Id: <comdog-ya02408000R1201981404440001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd1f40$a123fc20$160a010a@L83GZ.best-people.co.uk>, "Melanie Agostini" <magostini@best-people.co.uk> posted:

>I'm a contractor with C, unix and Oracle skills - I'm thinking of doing a
>course in Perl can anybody tell me if this is the best course of action for
>me at present. Is there a great deal of demand for Perl and what would be
>the advantages?

you may want to read about how to choose a good subject line:

     http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

other than that, the best of course of action is determined by more
information than you have given.  if you learn best in a classroom
environment, take a class.  if you like learning on your own, pick up
Learning Perl [1], on which Stonehenge Consulting bases its popular Perl
courses [2].

good luck. :)

[1]
Learning Perl
Randal L. Schwartz & Tom Christiansen
ISBN 1-56592-284-0 
<URL:http://www.oreilly.com>

[2]
<URL:http://www.perltraining.com>

-- 
brian d foy                                  <comdog@computerdog.com>
Fifth Avenue Disaster! <URL:http://computerdog.com/brian/fire/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 12 Jan 1998 15:13:55 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: MacPerl: diagnosing "Out of Memory!"
Message-Id: <pudge-1201981513560001@ppp-18.ts-1.kin.idt.net>

In article <69bvct$ou$1@nyx.nyx.net>, mwest@nyx.net (Michael W. J. West) wrote:

# What is a good strategy to understand why MacPerl is giving
# "Out of Memory!" ?  I wonder if one of my hashes is getting
# far more keys than I thought, but some simple attempts to
# see give me no clue.

There are lots of reasons, the two most common being a memory leak or a
data structure too large to be represented internally by MacPerl.

# Is there some way to show how much memory is in use?  See what
# variables use the most memory?  On a Mac, is sysread, read,
# or <INPUT> the cleanest way to get data from a filehandle? 
# Since MacPerl seems to preallocate for the application, and
# I see no clues in the books, I am at a lost.  Could I use
# the debugger?  How do I learn about it?

The Mac::Memory module can help, as well as various Mac OS memory
utilities (such as Memory Mapper) and the "About This Computer ..." menu
item under the Apple in the Finder.

See the Toolbox Modules draft chapter of my upcoming book for some details
on Mac::Memory.

   http://www.ptf.com/macperl/ptf_book/draft.html

Also, check out the MacPerl mailing list, which is linked to on the
MacPerl Pages at:

   http://www.ptf.com/macperl/

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: 12 Jan 1998 19:03:00 GMT
From: srdan@stc06.ctd.ornl.gov (Srdan Simunovic)
Subject: newbie Q: N of operations
Message-Id: <69dpd4$ghs$1@stc06.ctd.ornl.gov>

I have a general question on working with perl. For example:

	$in++;
	$nlist[$in]=$n;

is MUCH faster than

	@nlist=(@nlist,$n);	

Since I am working with large datasets (CAD conversion) is there a
place where I can get information about orders of computational
operations for typical perl expresions or if there is a utility that
does that?

Thanks,

-- 
Srdan Simunovic


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

Date: 12 Jan 1998 14:27:14 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: newbie Q: N of operations
Message-Id: <69dqqi$1g4$1@stok.co.uk>

In article <69dpd4$ghs$1@stc06.ctd.ornl.gov>,
Srdan Simunovic <srdan@stc06.ctd.ornl.gov> wrote:
>I have a general question on working with perl. For example:
>
>	$in++;
>	$nlist[$in]=$n;
>
>is MUCH faster than
>
>	@nlist=(@nlist,$n);	
>
>Since I am working with large datasets (CAD conversion) is there a
>place where I can get information about orders of computational
>operations for typical perl expresions or if there is a utility that
>does that?

Most of the time thinking about what's going on can help a bit.  I will
confess to not really worrying too much about O on the datasets I usually
work with, but

  @nlist = (@nlist, $n);

probably makes a whole new copu of @nlist, tacks $ on the end, gets rid of
the old @nlist then makes @nlist the new list (I don't care to look under
the hood, so these are just wild guesses ;-)  Another way to do this in
perl is

  push @nlist, $n;

where push knows about the structure of perlarrays and can tack the
new element onto the end of @nlist quite quickly. (splice is a more
general way of manipulating list additions and deletions.)

Sorry I haven't helped with the list of O characteristics of perl
functions.  sort currently uses your C library qsort.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Mon, 12 Jan 1998 20:25:30 +0100
From: tobez@plab.ku.dk
Subject: Re: newbie Q: N of operations
Message-Id: <34BA6E2A.5998@plab.ku.dk>

Srdan Simunovic wrote:

> I have a general question on working with perl. For example:

>         $in++;
>         $nlist[$in]=$n;

> is MUCH faster than
> 
>         @nlist=(@nlist,$n);

And
	push @nlist, $n;

is yet faster.

> place where I can get information about orders of computational
> operations for typical perl expresions or if there is a utility that
> does that?

Use
a) the common sense;
b) the Perl documentation.

There is some information in the latter, though quite dispersed.

Hope this helps,

Anton.


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

Date: Mon, 12 Jan 1998 14:08:44 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Email Ques!! Thanks for Help! 8-)
Message-Id: <comdog-ya02408000R1201981408440001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34B80E83.B9F@arrowweb.com>, mhanson@arrowweb.com posted:

>Is there a way to make a perl program that will allow you to setup email
>accounts for the members of your site, but yet not have to setup
>additional pop accounts? Like to make a program so users can get a free
>email account, but without setting up pop accounts.

yes.  but how are users to retrieve their mail?

are you having trouble implementing this in Perl?  on which part
did you get stuck or have problems?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Mon, 12 Jan 1998 13:57:15 -0500
From: Chad Baker <cmbaker@fedex.com>
To: cwtalbot@intellex.com
Subject: Re: perl under windows95
Message-Id: <34BA678B.A0AD9F68@fedex.com>

> I recently loaded perl5 and am having trouble running it. I tried the
> Start menu then Run,typed "perl ProgramName.pl", but that doesn't work.
> Any ideas how to launch perl and run my program?

Make sure Perl/bin is in the path.
(Assuming that you have the DOS window popped, that is)
You can edit the autoexec.bat file to modify the path,
although the script used to install Perl should have
taken care of that.
After editing, shut down and restart windows.
If this doesn't do it, specify the full path name
on the command line.
C:\Perl\bin\perl ProgramName.pl
Hope this helps
Chad Baker


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

Date: Mon, 12 Jan 1998 14:13:16 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Search engine? Do u?
Message-Id: <comdog-ya02408000R1201981413160001@news.panix.com>
Keywords: from just another new york perl hacker

In article <01bd1d8e$87380940$21658ea1@jaring>, "Leslie Chan" <adline@pc.jaring.my> posted:

>Any one have a really cool and fast search engine scripts? I'm looking for
>one. Kindly give me a little bit of information if you have any...

i seem to remember some being listing in Yahoo.  good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
deja-view it seems.


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

Date: 12 Jan 1998 20:34:00 GMT
From: jdmadea@cs.millersv.edu (Jeremy Madea)
Subject: Sys::Syslog problems.
Message-Id: <69duno$tm4$1@jake.esu.edu>

Sys::Syslog is not working for me...

Running on 5.004_04 on linux (2.0.32). Code:

#!/usr/bin/perl -d

use Sys::Syslog;

openlog("sl.pl [$$]", 'cons,ndelay,nowait', 'user');
$!=55;
syslog('info','Info test with error: %m and a 3:%d', 3);
closelog;

#################################

syslog is configured correctly and tests in C work fine.
Debugger walkthrough looks OK...
netstat shows the connection, but no bytes ever seem to get transfered...
$! is at some point set to "Bad File Number"...(I think in &closelog.)
script does not die or croak...

Anyone have any clues what is going wrong?!
Please email replies to jdmadea@cs.millersv.edu

Thanks,
-j


--

<----------------------------------------------------------------------------->
/                                                                            /
\   My two cents aren't worth a dime.		 Jeremy Madea == bones       \
/						 jdmadea@cs.millersv.edu     /
\   http://cs.millersv.edu/~jdmadea/homepage.html                            \
  \__________________________________________________________________________/
   boneyard:~$ uname -nmsr
   Linux boneyard 2.0.32 i586

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d-@ s-: a- C++++$ UBLS++++$ P++++$ L+++$>++++ E-@>+++ W-(++)$ N++@ !o
!K w--- !O M--(-) !V(--) PS+++@ PE@ Y+@>++ PGP@>+ !t 5 X+ R !tv
b+++>++++ DI(++) D-(+) G e>++ h(+) r>$ y+*(**)
------END GEEK CODE BLOCK------


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

Date: Mon, 12 Jan 1998 13:08:49 -0700
From: "Chris Wallace" <gspirit@flash.net>
Subject: Testing for valid numeric values
Message-Id: <69dth5$ad5$1@excalibur.flash.net>

Having come from a world of strongly typed languages,
Perl is proving to be interesting, to say the least.

I need to extract a portion of a string and ensure
that it's a valid numeric value. In pseudo-code,
something like this:

if IsNumeric(substr($myvariable, 3, 6))

What's the Perl equivalent of "IsNumeric"?

Thanks,
Chris





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

Date: Mon, 12 Jan 1998 15:44:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Testing for valid numeric values
Message-Id: <comdog-ya02408000R1201981544250001@news.panix.com>
Keywords: from just another new york perl hacker

In article <69dth5$ad5$1@excalibur.flash.net>, "Chris Wallace" <gspirit@flash.net> posted:


>What's the Perl equivalent of "IsNumeric"?

it depends on what you think numeric is (for instance, matters of
base).

$number =~ m/^ \d+ $/x;                  #decimal
$number =~ m/^ (?:0x)? [a-fA-F9-0]+ $/x; #hex

you can wrap these in a function along with any other sort of 
logic that you might need.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 12 Jan 1998 12:34:01 -0800
From: Ben Gertzfield <che@debian.org>
To: gspirit@flash.net
Subject: Re: Testing for valid numeric values
Message-Id: <y9hg1mte8jq.fsf@always.got.net>

(Posted and mailed.)

>>>>> "Chris" == Chris Wallace <gspirit@flash.net> writes:

    Chris> Having come from a world of strongly typed languages, Perl
    Chris> is proving to be interesting, to say the least.

Hooray! Perl is very cool. :)

    Chris> I need to extract a portion of a string and ensure that
    Chris> it's a valid numeric value. In pseudo-code, something like
    Chris> this:

    Chris> if IsNumeric(substr($myvariable, 3, 6))

    Chris> What's the Perl equivalent of "IsNumeric"?

Please check out the Perl FAQ. It should come with your installation
of Perl -- just run "perldoc perlfaq" to see the separate sections.

Your question is answered in perlfaq4:

How do I determine whether a scalar is a number/whole/integer/float?

If you can't get perldoc to work, the FAQ is available off of
www.perl.com.

-- 
Brought to you by the letters N and R and the number 7.
"He's like.. some sort of.. non-giving up.. school guy!" -- Bart Simpson
Ben Gertzfield <http://www.imsa.edu/~wilwonka/> Finger me for my public
PGP key. I'm on FurryMUCK as Che, and EFNet and YiffNet IRC as Che_Fox.


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

Date: 12 Jan 1998 12:37:59 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Testing for valid numeric values
Message-Id: <69duv7$474$1@shell3.ba.best.com>

In article <69dth5$ad5$1@excalibur.flash.net>,
Chris Wallace <gspirit@flash.net> wrote:
>if IsNumeric(substr($myvariable, 3, 6))
>
>What's the Perl equivalent of "IsNumeric"?

There isn't one directly. However, you can do the same thing with a 
regular expression. Something like the following should work:

sub IsNumeric($) {
	$_[0] =~ m/\D/ ? 0 : 1;
}

if IsNumeric "123.4567" {
	print "Numeric!\n";
}
else {
	print "Not numeric!\n";
}

Hope this helps.
/MC

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: Mon, 12 Jan 1998 13:41:24 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: mark666769@aol.com
Subject: Re: What does qw mean?
Message-Id: <34BA71E4.F8836ECC@mail.uca.edu>

Mark666769 wrote:
>
> use CGI qw(:standard);
> 
> It's just the syntax - what exactly does "qw" mean in the syntax
> of Perl? "Learning Perl" doesn't cover it, and I couldn't find
> it in the faq.

I'd be _real_ surprised if the Llama doesn't cover it, because LPoW32S
(the Gecko) has it in Chapter 3, "Arrays and List Data." 

I would guess the reason you're confused is the context of the line in
the script you're reading, namely, the tags (:foo :bar) are read in as
an array, and there's only one item in the array here.

Hey, the first time I saw it, it got me, too, until I relaxed enough to
start thinking "out of the box," but that will come.

Cameron Dorey
camerond@mail.uca.edu


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

Date: 12 Jan 1998 21:30:17 GMT
From: matthew@freerange.com (Matthew Barbour)
Subject: Re: WHY DOES THIS FAIL?
Message-Id: <69e219$83c$1@cat.freerange.com>

Yes, the code that Clark offered is more concise and "C-like".
It is certainly more pleasing to the eye also. 
Although, because redundant parens never hurt, I would write it like this:
$y = (($x eq "yes") ? "YES\n" : "NO\n");
I hope that is still syntactically correct in Perl!

Matthew

In article <dsoqtbpl8.fsf@elmo.s3i.com>, clark@s3i.com says...
>
>
>"Shade L. Jenifer" <sjenifer@isc.mds.lmco.com> writes:
>> when I run this code:
>> 
>> $x = "yes";
>> ($x eq "yes") ? $y = "YES\n" : $y = "NO\n";
>> print $y;
>> 
>> I expect(ed) "YES\n" to be written to STDOUT.  However,
>> "NO\n" appears.  Why is this?
>
>Hmm....I don't know why it does this.  However, this is not the way
>that I would use the test statement, since the whole idea is to use
>the return value.  I think that you really want:
>
>$y = ($x eq "yes") ? "YES\n" : "NO\n";
>
>-- 
>Clark



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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 1623
**************************************

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