[8389] in Perl-Users-Digest
Perl-Users Digest, Issue: 2006 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 3 00:07:52 1998
Date: Mon, 2 Mar 98 21:00:26 -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, 2 Mar 1998 Volume: 8 Number: 2006
Today's topics:
Re: "Learning Perl" or "Programming Perl" (steve)
Re: "Or" Operator? <ajh@rtk.com>
a newbie regexp question <psrjeff@exisnospam.net>
Re: Advice on good CGI Form CONTENT (steve)
Re: Conflict in this Newsgroup (steve)
Re: Courthouse and Perl <webmaster@fccjmail.fccj.cc.fl.us>
Re: GDBM for WinNT <rothd@xrxoxtxhx.xnxextX>
Is there a way to dynamically link subroutines? (Gene A Brock)
Learn Perl on the WEB? (7sD_.q<V6i)
Opening Files <gossfam@wolfenet.com>
Re: Perl & MS SQL Server <rothd@xrxoxtxhx.xnxextX>
PERL: Can someone help me with my code? <poohba@io.com>
Q: Appropriateness of (my $x = shift;) vs (my $x = @_;) (John "Chris" Wren)
Re: Q: Appropriateness of (my $x = shift;) vs (my $x = <jdf@pobox.com>
Re: recommend a db for Win95 for web apps <gfaircl@us.ibm.com>
Re: reg expression help.. (Alex Krohn)
Re: Stripping (Most) HTML tags (steve)
Re: stumper: fun with perl (steve)
using -e on a wildcard match (Michael Shavel)
Re: using -e on a wildcard match <jdf@pobox.com>
Re: Webmaster Job, Montgomery Alabama (Jim Michael)
Re: What does this one-liner do? <rjk@coos.dartmouth.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 03 Mar 1998 03:41:04 GMT
From: steveh@cent.com (steve)
Subject: Re: "Learning Perl" or "Programming Perl"
Message-Id: <35007b0f.131669540@news.cent.com>
as a " Windows developer familiar with C, C++, Pascal and all sorts
of OSs and major and minor languages" i would say neither, i would
instead suggest "Cross Platform Perl" for Unix and Windows NT" by Eric
R. Johnson ISBN 1-55851-483-X
On Sat, 28 Feb 1998 12:39:47 -0600, benbean@yahoo.com-*nospam*-
(Benjamin Smith) wrote:
>Hi,
>
>I'm trying to get started with Perl and I'd like to purchase a book
>from those fine people at O'Reilly but minimize my initial expenses by
>only getting one. My question is "Learning Perl" or "Programming
>Perl"?
>
>They both cover a lot of material. Is there much overlap between the
>two? Do they complement each other or offer different things? Is
>"Programming Perl" more advanced, or does it too start from scratch?
>
>I'm a Windows developer familiar with C, C++, Pascal and all sorts of
>OSs and major and minor languages so I don't need to be completely
>hand-held... I need a quick introduction to bring me up to speed.
>
>Any thoughts would be appreciated.
------------------------------
Date: Mon, 2 Mar 1998 18:35:09 -0800
From: "Aaron Harsh" <ajh@rtk.com>
Subject: Re: "Or" Operator?
Message-Id: <6dfq7p$6jp$1@brokaw.wa.com>
Abigail wrote in message <6d5mp2$nfc$3@client3.news.psi.net>...
>Duncan Cameron (dcameron@nospam.bcs.org.uk) wrote on 1640 September 1993
>++ ANY value of $var1 will either not equal 1 or will not equal 2
>Not in Perl!
I suppose you can do this with operator overloading:
package AbigailsRight;
%OVERLOAD = ( 'ne' => sub {} );
sub new { bless [] }
package main;
$var1 = new AbigailsRight; # Not equal to nothing :-)
print "Abigail's right\n"
unless $var1 ne 'value 1' || $var1 ne 'value2';
So there's nothing that's $var1 is not equal to, although pretty much
anything is not equal $var1.
How were you thinking of doing it, Abigail?
--
Aaron Harsh
ajh@rtk.com
------------------------------
Date: Mon, 2 Mar 1998 21:26:25 -0500
From: "Jeff Barnes" <psrjeff@exisnospam.net>
Subject: a newbie regexp question
Message-Id: <6dfpmq$auq$1@grouper.exis.net>
$temp = ($file =~ /\d*/);
if ($temp < 2) {
$next = ($temp++);
}
else {
$next = ($temp++);
$prev = ($temp--);
}
this doesn't work. if the number in $file is a 2 digit number, $next becomes
a 3 digit number with the first digit being an increment of one of the \d's
in $file. Why, and how can I fix it?
Jeff
--
When replying, please remove nospam from the following address.
psrjeff@exisnospam.net
------------------------------
Date: Tue, 03 Mar 1998 01:44:36 GMT
From: steveh@cent.com (steve)
Subject: Re: Advice on good CGI Form CONTENT
Message-Id: <34fc6066.124843085@news.cent.com>
the guidelines for a good form are as follows: make it what you want
it to be.
On Thu, 26 Feb 1998 12:18:25 -0600, Eric Winter <winter@mot.com>
wrote:
>Making the form is trivial my question is what are the guidelines
>for writing a good one.
>
>I'm looking for some common sense guidelines when writing the
>standard: send me your name/phone/address CGI form.
>
>There are lots of
>lousy forms out there. Forms that ask too much and reject
>an input if certain fields are not filled out, etc. What
>I'd like the the advice of someone whose done about 100 of these
>silly forms whose made some mistakes which in retrospect seem
>trivial and obvious, but didn't when writing their first.
>
>
>Do:
>e.g.: separate first and last names into two fields so it's easy
>to figure out which is which.
>
>Include at least (at most?) 2 lines for the address.
>
>
>Don't:
>
>forget Ms. as a possible title
>
>require ansewers to 50 or more questions
>
>
>Don't write output to a publicly readable file(?)
>
>
>
>Any intelligent advice is welcome
>
>
>
>Eric Winter
------------------------------
Date: Tue, 03 Mar 1998 03:48:32 GMT
From: steveh@cent.com (steve)
Subject: Re: Conflict in this Newsgroup
Message-Id: <35027d82.132296362@news.cent.com>
you r an ass
On 1 Mar 1998 17:19:40 GMT, "V. Chandrasekhar" <shaker@netusa1.net>
wrote:
>1. Most of yesterday, I have been thinking about what I am posting
>in present post. However, I quite don't have the time to develop
>the arguments fully, today. If there is interest, I will consider
>doing it at a later time. Here, I present these in outline form.
>
>2. Two types of interactions may be identified in people relations:
>
> Master - Disciple (MD) (Rare in msot places)
>
> Consumer - Producer (CP) (Very common)
>
>Some Perl masters want this newsgroup (NG) to operate MD. Some
>'disciples' are perfectly willing to do this, because of what they
>are able to learn. They also feel that this is how this NG should
>function. Some feel that this is how it functioned - pre 1993.
>Disciple is expected to show a lot of self-discipline, not ask
>anything that will anger the master, only ask things that provide
>the master at least some measure of amusement, in general let the
>master dictate, make sure that they don't piss him off, [walk at
>least three steps behind the master, genuflect at least three times
>a day :) ]etc.
>
>At least some posters come expecting a measure of the CP
>relationship. They expect not to be insulted when they ask
>questions (after all, they are asking questions on Perl not Rig
>Veda). Some of them are long term users in other NGs where many of
>the attempted strictures of this NG (for instance, what e-mail
>addresses will be tolerated, whether address munging may be used as
>a form of spam control or not) are not present.
>
>3. When the Perl masters teach courses, almost certainly a CP
>relationship applies; nobody's head is bitten off when the students
>ask a FAQ or a CGI question in a Perl class.
>
>4. When the Perl masters publish books, again a CP relationship is
>evident. The various animal books go to considerable trouble to
>create an air of friendliness and an including / accepting
>community.
>
>5. Between a poster and his ISP, there is a CP relationship. The
>ISP gives each subscriber the right to post in all groups. The ISP
>takes care of the necessary infrastructure, upstream feed,
>downstream feed, whatever. DejaNews provides this too as a free
>service.
>
>6. This NG is where the two cultures clash. Do the Perl masters and
>their supporters have the right to allow only MD interactions,
>chasing the other group away by insults, whatever ? How are they
>going to do it ? By making this a moderated NG ? Otherwise, the
>battle may continue. (Note, I am NOT saying I am going to fight
>continue the battle; I am NOT going to.) New folks are going to be
>coming in all the time and do things like other newcomers in the
>past.
>
>7. I don't see commercialism on the part of Perl masters in this NG
>at all. Perhaps this is a part of the problem. Maybe this is an
>interest not being served at the present time. Supporting Perl
>masters, developers and implementors (by buying their products and
>services) is good for Perl. Perhaps stronger promotion of these in
>this NG (say a once weekly auto-posting such as the miniFAQ) could
>be encouraged. The masters may feel uncomfortable that this may
>lead to criticism that they are using the NG solely for their own
>purposes. However, this is someone else's - me, an outsider's -
>idea; not theirs. Someone else can write the promo. I will be glad
>to write an initial version. If this is done, maybe the masters may
>not feel as much that people are stealing their intellectual
>property (taking the last shilling out of their pocket). I have
>absolutely no problem if the interests of the masters are strongly
>promoted here. Maybe there a netiquette deprecating this type of
>promotion. However, who is going to enforce this ? What if the
>majority had no problems with this type of promotion - can't this
>be done ?
>
>8. What about the interests of the newcomers to Perl ? How about
>setting up another newsgroup where atmosphere is definitely not so
>MD ? The masters need not respond to posts here at all, other than
>promoting their products, unless they want to. Something like
>'comp.lang.perl.intro'.
>
>9. I also suggest that the mini-FAQ be beefed up describing the
>ground rules better, in a polite tone. For instance, the following
>may be added:
>
>. Perl5 is the only focus of clpm (and not Perl4; sorry this has
>been discussed and agreed upon)
>
>. Posters ARE expected to have made the expected effort via books,
>Dejanews, and man pages before posting
>
>. Top 10 most commonly asked questions included in the miniFAQ
>itself along with brief answers.
>
>10. What exactly am I saying here in this whole post ? Instead of
>resorting to insults and abuses (which utterly destroy the spirit
>of bonhomie the cute animal books go to so much trouble to create),
>TMTOWTDI - there may be more than one way to achieve the intended
>results (with everybody coming off better in the bargain). Let's
>make it win-win (including allowing/providing a way for win32s to
>thrive).
>
>Peace and Regards.
>
>Venkataraman ("Shaker") Chandrasekhar
>
>
------------------------------
Date: Tue, 03 Mar 1998 03:47:48 GMT
From: Bill Jones <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Courthouse and Perl
Message-Id: <34FB7C31.7888BB2A@fccjmail.fccj.cc.fl.us>
Yes, you would have a better chance of long-term success with Perl; with
a smattering of other things mixed in...
:-)
Butch Bridges wrote:
> I am trying to decide if Perl is the way to go with placing our court
> records on the Net so the public can access them. Is it very
> complicated? Please reply by email with any suggestions or help. I
> really know nothing about doing this. Thanks....... Butch Bridges
>
> bridges@brightok.net
> Ardmore, Oklahoma
------------------------------
Date: 3 Mar 1998 02:59:42 GMT
From: "Dave Roth" <rothd@xrxoxtxhx.xnxextX>
Subject: Re: GDBM for WinNT
Message-Id: <01bd4650$c48c50e0$0101a8c0@main2>
Neal Kaiser <shanahjc@ibm.net> wrote in article
<34FAF3DD.59471C0C@make-a-store.com>...
> I have written a program that I want to port to NT. But
it uses GDBM
> files. Any idea where I can find GDBM for WinNT and a
Perl for Win32
> which has that module?
GDBM and GDBM_File has been ported to the Win32 platform.
Look at the http://www.roth.net/consult/ web page and
follow the link regarding GDBM. Let me know if there is any
more info you need.
Keep in mind that GDBM is platform specific so databases
you created on one machine may not be transportable to
another without conversion.
dave
--
============================================================
====
Dave Roth ...glittering
prizes and
Roth Consulting endless compromises,
shatter
rxoxtxdxxrxoxtxhx.xnXeXt the illusion of
integrity
My email address is disguised to fool automailers. Remove
the
X's to send me email.
************************************************************
****
Use of this message or email address for commercial
purposes
(including "junk" mailings) is strictly prohibited and
protected
under current international copyright laws and United
States
Code, Title 47, Chapter 5, Subchapter II.
------------------------------
Date: 3 Mar 1998 02:19:23 GMT
From: gbrock@isc.sjsu.edu (Gene A Brock)
Subject: Is there a way to dynamically link subroutines?
Message-Id: <6dfpbb$d0$1@hades.csu.net>
I am working on a program that loads in many Perl variables, and it
would be great if I could include the data as a subroutine after
saving it in Perl syntax. The problem is, I don't know the name of
the file to require beforehand. I must ask the user, then load his
/her data. So initially, I included a set temporary file, then copied
the file that the user requested to that temporary file, and tried
to require the copied file as a subroutine. It compiles, but I always
get a run-time error "<STDIN> chunk 3." Is there any way to dynamically
change code during run-time? If anyone could answer my question, I
would greatly appreciate it.
Gene Brock
gbrock@email.sjsu.edu
------------------------------
Date: 3 Mar 1998 02:39:39 GMT
From: taiwan@glink.net.hk (7sD_.q<V6i)
Subject: Learn Perl on the WEB?
Message-Id: <6dfqhb$iiv$1@unix2.glink.net.hk>
Dear Perler,
Just a newbie's question. Any WEB provide online tutorial for PERL ?
--
< 7sD_.q<V6i >
------------
URL : http://www.glink.net.hk/~tristan (A-mei)
URL : http://www.glink.net.hk/~taiwan (PowerStation)
------------------------------
Date: Mon, 02 Mar 1998 20:10:33 +0900
From: "$oq~Vrde|" <gossfam@wolfenet.com>
Subject: Opening Files
Message-Id: <34FA93A9.4497@wolfenet.com>
I am trying to use loops to open files, since al of them dont have to be
opened at any particular time.
The files to be opened are
m1.dat to m9.dat
The Variables are
$i : just your standard index counter
$sphandle : this is the file handle name, which is constructed using
loops
$splevel : this is the name of the file constructed using loops
THIS IS THE BIG QUESTION I think...
Can I do this?? @$var (meaning I want to create an array with a name
of $var)
If anyone can help me with this I would be very greatful.
sub open_spells {
my($i);
for ($i = 1; $i <= $max; $i++){
$splevel = "m"."$i".".dat";
$sphandle = "M"."$i";
$var = "m" ."$i";
open ("$spandle", "$splevel");
@$var = <$sphandle>;
while (@$var > 0) {
print ("in");
$popped = pop (@$var);
print("$popped\n");
}
}
}
Henry Goss
------------------------------
Date: 3 Mar 1998 03:14:26 GMT
From: "Dave Roth" <rothd@xrxoxtxhx.xnxextX>
Subject: Re: Perl & MS SQL Server
Message-Id: <01bd4652$d3f2f6e0$0101a8c0@main2>
Sebastian <sebfrey@advancedh2o.com> wrote in article
<6dc1bj$3hp$1@news0-alterdial.uu.net>...
>
> O' NT Perl Gurus -
>
> I've just spent the better part of the day downloading
various perl modules
> and whatnot in the hopes of writing a few scripts to
access data stored in a
> Microsoft SQL Server 6.5 database. OK, I'll come right
out and say it: I
> can't even BEGIN to get it working. I've tried
Win32::ODBC, MSSQL/DBLib,
> and the ASP/ADO Examples that come with (I think)
PerlScript. None of them
> work, for a variety of reasons which I'll spare you.
I have used Win32::ODBC to access SQL Server 6.5 without
any problems. I have used both security models on the
scripts.
dave
------------------------------
Date: Mon, 2 Mar 1998 21:58:46 -0500
From: Chocolate <poohba@io.com>
Subject: PERL: Can someone help me with my code?
Message-Id: <Pine.BSI.3.96.980302215616.2417A-100000@xanadu.io.com>
I am having a problem. I have this script that is a logout script. It is
done using a cookie. When the person logs in their information is put
into a file. When this person logs out I want to erase that persons
information. I thought I knew how to do it but I guess I don't. the
script is at www.io.com/~poohba/Scripts/bye.pl. Can you please help and
offer any suggestions.
------------------------------
Date: Tue, 03 Mar 1998 03:22:14 GMT
From: jcwren@atlanta.com (John "Chris" Wren)
Subject: Q: Appropriateness of (my $x = shift;) vs (my $x = @_;)
Message-Id: <34fc7586.716672350@nntp.atlanta.com>
I've succeeded in teaching myself enough Perl from net-based
tools to be very dangerous. I've even got my application sort of
working.
However: I can find virtually nothing that explains the @_
operator. I seem to know that when a subroutine is called, whatever
arguments are passed into the @_ variable.
I've seen some code that uses
my $somevar = shift;
and some code that uses
my $somevar = @_;
and even
my ($var1, $var2, $var3) = @_;
I understand the third usage, but I don't understand what
makes the first two different. I've tried changing my code from the =
shift to the = @_ version, and it breaks.
I intend to buy the O'reilly book, which I'm willing to bet
explains all, but my local book hawker is out of stock. Can kind soul
explain this for me?
(This is typical, by the way. My script can read and write
web pages, and I've got it mostly coupled to an Access database using
the DBI package, but some simple syntatic thing escapes me...)
- John Wren
---
John "Chris" Wren, KD4DTS
jcwren@atlanta.com
770-945-8288 (H)
770-840-9200 x2417 (W)
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
------------------------------
Date: 02 Mar 1998 23:51:52 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Q: Appropriateness of (my $x = shift;) vs (my $x = @_;)
Message-Id: <g1l0idg7.fsf@news.concentric.net>
jcwren@atlanta.com (John "Chris" Wren) writes:
> I seem to know that when a subroutine is called, whatever
> arguments are passed into the @_ variable.
I can't stop giggling over "I seem to know." It's too funny.
> I've seen some code that uses
> my $somevar = shift;
> and some code that uses
> my $somevar = @_;
> and even
> my ($var1, $var2, $var3) = @_;
>
> I understand the third usage, but I don't understand what
> makes the first two different. I've tried changing my code from the =
> shift to the = @_ version, and it breaks.
Don't you like using shift? Perhaps you're worried about it because
you don't grok it. Please read "perlfunc," and look for "shift."
Don't be scared shiftless.
If you've actually seen code that does the second thingy there, then
please ignore it with extreme prejudice. In that example, $somevar
receives the number of arguments passed to the sub. Come to think of
it, sometimes that's what you want, but I don't think that's what you
think it's doing.
The first example actually removes the first element of @_, shortening
it.
The third example does not alter @_.
If you want to assign a list element to a scalar, you may either
explicitly refer to the list element:
my $param = $_[0]; #which is not very idiomatic
or you may create list context for the assignment
my ($param) = @_; # giving $param the first element of @_
Your homework is to read the following perldocs: "perlsub," "perlref,"
and "perldata." Stop writing on your desk. Sit up straight. Thank you.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Mon, 02 Mar 1998 19:47:33 -0800
From: Gary Faircloth <gfaircl@us.ibm.com>
Subject: Re: recommend a db for Win95 for web apps
Message-Id: <34FB7D51.949B5049@us.ibm.com>
Define a "web app." Since the web browser is nothing more than an interface
to HTML, you can make the app can be as weak or as powerful as you want.
If you already have existing Access databases, Microsoft's web servers
already
have the capability of interacting with them using ISAPI and ODBC. In fact,
with ODBC, you can connect to any database. Most databases such as Sybase,
Oracle, and DB2 all have ODBC compliant client interfaces to them. The Peer
Web Server has documentation on ISAPI and it has some sample applications,
too.
Creating web pages this way is alot like creating form letters in word
processors, but
it does require a little bit of SQL knowledge so you can structure your
queries right.
If you already know Perl and haven't created your Access database yet, you
could
just use flat-text files or perldb, and interact with them using perl CGI
scripts.
The great thing about perldb is that all you need is perl to access it. So,
if you
plan on moving the database and scripts to another server, chances are perl
is
accessible if it's a UNIX server.
I'm sure there are some good perl scripts out there that simplify the access
to
perldb, and perhaps some that already do what you want. Though I don't know
where to refer you. I'd like to know myself. I already visited
www.perl.com a
couple of times and didn't quite find what I was looking for.
Joey Garcia wrote:
> Could anyone recommend a good db that isn't overkill for web apps,
> something to get my hands wet. I have Access, would that be the best
> choice for an app on my pc? what if I wanted to move it to the web? what
> is a common app that I wouldn't have trouble finding IPS support for?
>
> Thanks
-g-
------------------------------
Date: Tue, 03 Mar 1998 04:24:26 GMT
From: alex@gossamer-threads.com (Alex Krohn)
Subject: Re: reg expression help..
Message-Id: <34fb84db.23883288@coburg>
Here's what I've got so far:
$default_expr = "word";
$default_expr = "\\Q$default_expr\\E" unless ($in{'re'});
$default_expr = "\\b$default_expr\\b" if ($in{'ww'});
$default_expr = "(?i)$default_expr" unless ($in{'cs'});
and in the main loop:
$search_expr = $default_expr;
$search_expr =~ s/word/$search{$db_cols[$field]}/;
eval { next LINE unless ($values[$field] =~ /$search_expr/); };
$@ && return ("error in regular expression.");
Now the problem I'm having is the \Q isn't getting interpretted
properly? Here's what happens when i search for "form" using the
above:
Searching '(?i)\Qform\E' against 'UNIXhelp for users'
Searching '(?i)\Qform\E' against 'Tom's Hardware & Performance Guide'
now the second line should have matched, and it does match if I remove
the \Q and \E.
If I only put one backslash:
$default_expr = "\Q$default_expr\E" unless ($in{'re'});
then the reg expression doesn't show that the \Q and \E are there..
Any ideas?
------------------------------
Date: Tue, 03 Mar 1998 03:12:22 GMT
From: steveh@cent.com (steve)
Subject: Re: Stripping (Most) HTML tags
Message-Id: <34fe750b.130129513@news.cent.com>
sassy
On 2 Mar 1998 02:12:21 GMT, abigail@fnx.com (Abigail) wrote:
>Tim Archer (tarcher@csu.edu.au) wrote on 1641 September 1993 in
><URL: news:34F6361C.380E2C18@csu.edu.au>:
>++ Hi all.
>++
>++ I am looking for a perl script that will strip all tags except for a
>++ given list from a document.
>
>What is it that HTML::Parser doesn't give you?
>
>
>
>Abigail
>--
>perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle 'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
Date: Tue, 03 Mar 1998 03:10:40 GMT
From: steveh@cent.com (steve)
Subject: Re: stumper: fun with perl
Message-Id: <34fd6324.125545014@news.cent.com>
On Thu, 26 Feb 1998 22:37:06 -0500, Dan Boorstein <danboo@negia.net>
wrote:
>i have come across some odd behavior,
(yes you look a little funny)
>summary: write a script which prints "foo\n" when run interactively
>but "bar\n" when run from a file.
? can it be interactively run from a file ?
> your script must print "foo\n" and only "foo\n" when run
> interactively and must print "bar\n" and only "bar\n" when
> run from a file.
o.k. what if foo and bar were
both "whatever" ? now thats a stumper !
>
*****
> the text of your scripts must be the same.
we can use 2 ?
*****
>
> here's one way to do it by refering to the filename. this
> seemed obvious so it is outlawed (see below).
is it the same ? (see below)
> interactively:
> prompt> /usr/bin/perl
> print $0 eq '-' ? 'foo' : 'bar';
> print "\n";
> ^D
> foo
>
> from a file:
> prompt> cat foobar.pl
> print $0 eq '-' ? 'foo' : 'bar';
> print "\n";
> prompt> /usr/bin/perl foobar.pl
> bar
?
>qualifiers:
> 1. the same perl interpreter must be used for both trials.
can i use a clone ?
> 2. no command-line switches, parameters or arguments may be
> used aside from the script name.
is this a real teaser ? foo and bar we can use, so we can reference
> 3. the script cannot refer to its own filename through $0,
> __FILE__ or other methods (that would be too easy).
how about $scriptname =$0,__FILE__ ($first,$second)=? what is a
method in perl ? how about CWD ? hmm, if CWD = this then foo else
bar
> 4. the script may not reference external sources including,
> but not limited to, modules, libraries, databases or
> shell commands.
damm man, no databses ? you gotsta be kidding me man :-(
> 5. the script must assume that its environment is identical
> between trials, aside from the manner in which it is
> invoked of course.
will it assume that it has been invoked at all ?
> 6. and most importantly, have fun. :)
no need to refill my valium prescription
>
></MUSIC>
>
ps:
>good luck,
>
>--
>dan boorstein
------------------------------
Date: Mon, 02 Mar 1998 21:47:43 -0500
From: mshavel@erols.com (Michael Shavel)
Subject: using -e on a wildcard match
Message-Id: <mshavel-0203982147430001@130.9.16.207>
Hi
I am trying to search a directory for any files that end in .err
I am using this and realize it's not correct but don't know where to go from
here. Any help would be appreciated.
This is what I have:
if(-e /*.err/)
{
print "There is an error file\n";
}
else
{
print "No error file\n";
}
------------------------------
Date: 02 Mar 1998 23:35:36 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: using -e on a wildcard match
Message-Id: <hg5gie7b.fsf@news.concentric.net>
mshavel@erols.com (Michael Shavel) writes:
> I am trying to search a directory for any files that end in .err
You'll want to read up on a couple of perl builtins:
opendir
readdir
grep
These are documented in the "perlfunc" pod or manpage, depending on
your platform.
Of course, there's always
@files = `ls *.err`;
HTH.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Tue, 3 Mar 1998 03:30:05 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: Webmaster Job, Montgomery Alabama
Message-Id: <genepoolEp84E6.Ft2@netcom.com>
Don Nolte (dnolte@mindspring.com) wrote:
: Air Force JAG Department offers a position as Webmaster, GS-12.
Hopefully this is a telecommuting position.
------------------------------
Date: Mon, 02 Mar 1998 22:10:40 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: What does this one-liner do?
Message-Id: <34FB74B2.F4E7C0AB@coos.dartmouth.edu>
Jaime Metcher wrote:
>
> Abigail wrote:
> >
> >
> > Nope. ($a) = (7, 8, 9) is *not* a scalar assignment. It's a list
> > assignment. It just happens to have a side effect, setting $a to 7.
> > The result of the assignment is the list (7, 8, 9).
>
> From the Blue Camel p. 93:
> "In all cases, the value of the assignment is the new value of the
> variable".
You are not assigning to a variable, you are assigning to the list ($a).
Thus, that rule does not apply in this case. That rule is only for scalar assignment.
> How does this map to what you just said? Isn't the value of the first
> (i.e. rightmost) assignment (7)?:
No, the value of the rightmost assignment is 3.
> In the example
>
> ($a, $b, $c) = (7, 8, 9);
>
> what is "the variable"? If I do:
There is no "the variable" because this is a list assignment. See above.
> perl -e "print (join (':', ($a, $b) = (7, 8, 9)))"
>
> I get:
>
> 7:8
>
> which seems to imply that the "variable" is the LHS, which becomes
> (7,8). I've added $b to make it completely clear that the assigment is
> evaluating to a list, and that it evaluates to the list on the LHS.
That is a list assignment in a list context.
"In a list context, list assignment returns the list of new values just as
*scalar assignment* does." [my emph]
> I understand the "list assignment in a scalar context" rule and why it
> is so useful. What I don't understand is whether the list assignment
> rule is being claimed as being consistent with the "In all cases" rule I
> quoted above, or if it is an exception. Something like:
The 'in all cases' rule is 'in all cases of scalar assignment'. It does not
apply to list assignment.
> "The value of an assignment is the the value that gets assigned to the
> LHS, except where the assignment is a list assignment in a scalar
> context. In this case, the value of the assignment is the value of the
> RHS."
No, in that case, the value of the assignment is *the number of values* in the RHS.
You are attempting to make a rule which covers both scalar and list
assignment. There are already rules that cover scalar and list assignment
separately. Trying to make a single rule only confuses the issue.
--
_ / ' _ / rjk@coos.dartmouth.edu
( /)//)//)(//)/( chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
It's funny 'cause it's true ... and vice versa.
------------------------------
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 2006
**************************************