[7972] in Perl-Users-Digest
Perl-Users Digest, Issue: 1597 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 7 18:17:20 1998
Date: Wed, 7 Jan 98 15: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 Wed, 7 Jan 1998 Volume: 8 Number: 1597
Today's topics:
Re: arrays as parameters in subroutines <defaultuser@domain.com>
Re: bison for perl <zenin@best.com>
Re: bison for perl <eglamkowski@usa.net>
Re: Calling 'require' on an arbitrary module <zenin@best.com>
Re: Can I create a Linked List in Perl <tchrist@mox.perl.com>
Re: Editing Perl question <barnett@houston.Geco-Prakla.slb.com>
Re: Good place to start in Perl 5 <Claus.Eikemeier@medizin.uni-koeln.de>
Re: Good place to start in Perl 5 <barnett@houston.Geco-Prakla.slb.com>
h2n perl script (Craig Beckett)
Re: Net::LDAPapi's ldap_get_values <huard@netrev.com>
Re: Perl program transfer <asaha@cisco.com>
perLIS and $ENV{"PERLXS"} <hensh@math.msu.edu>
problem executing getting output <ric@megsinet.net>
Re: Q: search matching "(" and ")" (Ilya Zakharevich)
Re: Q: search matching "(" and ")" <*@qz.to>
range operator with decimal numbers <brendar@pcc.edu>
Re: Review of CGI/Perl book (James Stricherz)
Re: Running a perl script in the background on Windows <reibert@mystech.com>
Re: serious post about gmtime and year-1900 (was Re: Pe <*@qz.to>
Re: Storing A Text File Into A Variable -- How?? <jdporter@min.net>
Re: strangest Q you've seen regarding storing entire bi <tim@hcirisc.cs.binghamton.edu>
Re: Testing for valid RegExps? <tchrist@mox.perl.com>
Re: Trimming blanks (Martien Verbruggen)
Re: Unix perl shell ??? <zenin@best.com>
Re: Wildcard in if ( x = a ) ? <reibert@mystech.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 07 Jan 1998 14:59:58 -0600
From: brian <defaultuser@domain.com>
Subject: Re: arrays as parameters in subroutines
Message-Id: <34B3ECCE.7AE2C3C6@domain.com>
Brian wrote:
> Here's the code:
> ($update_statement, $insert_statement, $error_statement) =
> &create_stmt($table_name, @values, @column_info);
>
> &create_stmt gets the values for @values but @column_info is empty.
>
values are passed to subroutines as flat scalar lists. For example
$my_table_name = 'foo';
@my_values = (1, 2, 3);
@my_column_info = ('a', 'b', 'c');
&create_stmt($my_table_name, @my_values, @my_column_info);
# equiv to
# &create_stmt('foo', 1, 2, 3, 'a', 'b', 'c');
sub create_stmt {
($table_name, @values, @column_info) = @_;
# $table_name is 'foo'
# @values is (1, 2, 3, 'a', 'b', 'c');
# @column_info is ();
}
use arrary refs to pass two separate arrays. arrary refs can be thought
of pointers to the entire list. example:
&create_stmt($my_table_name, \@my_values, \@my_column_info);
sub create_stmt {
($table_name, $values_ref, $column_info_ref) = @_;
# $table_name is 'foo'
# use @$values_ref to access the my_values array
# use @$column_info_ref to access the my_column_info array
}
hth,
brian
------------------------------
Date: 7 Jan 1998 21:52:14 GMT
From: Zenin <zenin@best.com>
Subject: Re: bison for perl
Message-Id: <884210195.300863@thrush.omix.com>
John Porter <jdporter@min.net> wrote:
: The binaries are not distributed. You have to compile them
: yourself. That's the Internet/Unix Way!
Actually, they are for many systems. Check out a sunsite
for Solaris stuff such as ftp://sunsite.unc.edu/pub/solaris/sparc
--
-Zenin
zenin@best.com
------------------------------
Date: Wed, 07 Jan 1998 17:21:30 -0500
From: the count <eglamkowski@usa.net>
Subject: Re: bison for perl
Message-Id: <34B3FFEA.3631@usa.net>
Zenin wrote:
>
> John Porter <jdporter@min.net> wrote:
> : The binaries are not distributed. You have to compile them
> : yourself. That's the Internet/Unix Way!
>
> Actually, they are for many systems. Check out a sunsite
> for Solaris stuff such as ftp://sunsite.unc.edu/pub/solaris/sparc
They kind of have to for solaris, as Solaris doesn't bloody come
with a C compiler standard! :(
And they might for Win95 & NT as it is a real pain to try and port
stuff from UNIX to Win32...
Don't have experience with other systems, so I can't comment on any
others. If there are pre-compiled binaries, I would imagine in most
cases it is not officially supported by the creators of the software,
but just some random person trying to save others some work.
------------------------------
Date: 7 Jan 1998 22:10:07 GMT
From: Zenin <zenin@best.com>
Subject: Re: Calling 'require' on an arbitrary module
Message-Id: <884211267.699542@thrush.omix.com>
Tom Hukins <tom@NOSPAMeborcom.com> wrote:
: What my animal feeding code would do is something like this:
: $creature = $animal->{'creature'};
: require "Animal::$creature";
: Animal::$creature->feed($animal);
>snip<
: However, the code above would not work because require doesn't
: like package names like "Animal::$creature::. So, my question is,
: is it possible to do anything like this?
Yes, it is possible but you *really* should take a look at
perldoc AutoLoader.
To do what you're trying directly, you can do this (even if I
don't advise doing it this way):
no strict 'refs';
$creature = $animal->{'creature'};
eval { require "Animal::$creature" };
die "Invaild beast: $@" if $@;
"Animal::$creature"->feed($animal);
This however, is really, really not recommended. You should really
auto load this. Your code could then look as simple as:
$animal->feed;
And it would work. This is the entire reason to use objects in the
first place.
Here's an (untested, off the top of my head, use at your own risk)
autoload method that may work for you. This example reroutes *all*
unknown methods to a higher class that might know more, however if
you only want to do "feed" you can test for it.
use Carp;
sub AUTOLOAD {
no strict 'refs';
my $self = shift;
return if $AUTOLOAD =~ /::DESTROY$/;
$AUTOLOAD =~ s/^.*:://g; # Method name only please
eval { require "Animal::$self->{creature}" };
confess "Can not load Animal::$self->{creature} class: $@" if $@;
&{"Animal::$self->{creature}::$AUTOLOAD"} ($self);
}
--
-Zenin
zenin@best.com
------------------------------
Date: 7 Jan 1998 21:51:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Can I create a Linked List in Perl
Message-Id: <690tdn$rcr$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, scott@softbase.com writes
: Arrays *are* linked lists in Perl, with
:a very high level syntax!
No, they aren't. They are dynamic arrays.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
echo "Your stdio isn't very std."
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Wed, 07 Jan 1998 15:11:36 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Editing Perl question
Message-Id: <34B3EF88.FAE72CC1@houston.Geco-Prakla.slb.com>
Manyhats12 wrote:
>
> Is it possible to use notepad in Windows to edit a cgi script written in Perl?
Well, if you absolutely have to.... :-)
> I know that there should not be any carrige returns, but if it is saved as a
> text file, with editing done only between the lines, would it be a problem?
> Thank you in advance!
> -Leslie
If you're editing on a DOS machine, and will be putting it on a Unix box
later, just be sure that when you FTP the script to the Unix machine
that you transfer in Ascii mode, rather than Binary. The FTP program
should do the conversion automagically for you.
(I haven't tried it, but Perl might just be smart enough to ignore the
\r\n characters, and treat them as \n only.... Something to try when I
have the opportunity. :-) )
HTH.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Wed, 07 Jan 1998 22:24:24 +0100
From: Claus Eikemeier <Claus.Eikemeier@medizin.uni-koeln.de>
Subject: Re: Good place to start in Perl 5
Message-Id: <34B3F288.8610890C@medizin.uni-koeln.de>
Gabriele Endress wrote:
> Hi,
>
> I'm really interested in learning Perl 5 so I can begin writing my own
> CGI scripts. I was wondering if any of you had a recommendation of any
> good beginners books for me start with?
>
> This would be the first hard core programming language I'd be learning.
> The only other "code" I've ever learned are HTML and BASIC. :-)
>
> Thanks in advance,
>
> Gabi
> --
> --------------------------------------------------------------
> Gabriele Endress Symbios, Inc.
> Assistant Webmaster Fort Collins, CO
>
> "Reality is merely an illusion, albeit a very persistent one."
> - Albert Einstein (1879-1955)
> -------------------------------http://www.symbios.com---------
Dear Gabi,
a good choice would be
"Learning PERL" by Randal L. Schwartz (O'Reilly).
I bought the book in German and it helped me a lot.
I'm not sure, if in the newer version, there is a much on
Version 5.
If you stress on Version 5 ("object-oriented"), you nevertheless
have to know the basics of Version 4 and so in my opinion,
the above book is a good start.
After that you should go to a bookstore and choose the
right book yourself. I think there are a lot of good books
out there.
Hope that helps
Claus
Institute of Statistics, Informatics and Epidemiology (IMSIE),
University of Cologne
Germany
------------------------------
Date: Wed, 07 Jan 1998 15:07:17 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Good place to start in Perl 5
Message-Id: <34B3EE85.565B692@houston.Geco-Prakla.slb.com>
Gabriele Endress wrote:
>
> Hi,
>
> I'm really interested in learning Perl 5 so I can begin writing my own
> CGI scripts. I was wondering if any of you had a recommendation of any
> good beginners books for me start with?
>
Well, I recently taught myself Perl. I had some very basic C/C++
knowledge, some Basic knowledge, and some COBOL (long ago, and far away)
knowledge.
For me, _Learning Perl (1st Edition)_ (The Llama Book) by Randal
Schwartz (ISBN: 1-56592-042-2) was a great starting point. I tried to
follow that with _Programming Perl 2nd Ed._ (The Camel Book aka The Blue
Camel) by Wall, Christiansen & Schwartz (ISBN: 1-56592-149-6), but had
difficulty. A co-worker let me borrow his "Learn Perl4 in 21 days" book
(It took me more like 45 days due to other issues). That was a better
way to go, for me. It gave me far more examples, which is what I
needed, and made understanding how to program perl much easier. Once I
finished it, I went back to the Blue Camel, and it made much more sense.
I've been told that the _Advanced Perl Programming_ book is good, but I
haven't purchased it, yet. I just recently picked up the _CGI
Programming on the World Wide Web_ book by Shishir Gundavaram (ISBN:
1-56592-168-2). I find it to be informative. Still chewing on it,
however.
Unfortunately, I do not own stock in O'Reilly & Assoc., but they do
produce some of the best books I've had the need to use. The Nutshell
series of books have all the above mentioned books (except learn perl4
in 21 days). Great place to start.
> This would be the first hard core programming language I'd be learning.
> The only other "code" I've ever learned are HTML and BASIC. :-)
>
If you understand basic programming structure, Perl is fairly easy to
get started on right away from what is in the Llama book.
> Thanks in advance,
Good luck.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: 7 Jan 1998 22:20:53 GMT
From: craigb@efficient.com (Craig Beckett)
Subject: h2n perl script
Message-Id: <690v45$iv2$1@fishgate.efficient.com>
Hello,
I am looking for a perl script written by O'Reilly and Assoc
called h2n. It is used to create DNS database files from the /etc/hosts
file. Can anyone help me locate it?
TIA
craigb@efficient.com
------------------------------
Date: Wed, 7 Jan 1998 14:21:26 -0800
From: Paul Huard <huard@netrev.com>
To: Paul Huard <huard@netrev.com>
Subject: Re: Net::LDAPapi's ldap_get_values
Message-Id: <Pine.BSF.3.96.980107141904.4588B-100000@shell12.ba.best.com>
> I can't get ldap_get_values to generate any values and I'm hoping someone
> can take a look at the code below and tell me what I'm doing wrong. I know
> that the connection is successful because ldap_get_dn works fine.
Oops, I figured it out. My ldap_search_s has a 1 when it should have a 0.
ldap_search_s($ld,$BASEDN,LDAP_SCOPE_SUBTREE,$filter,\@attrs,1,$result)
^
Sorry,
Paul
------------------------------
Date: Wed, 07 Jan 1998 13:25:16 -0800
From: Amit Saha <asaha@cisco.com>
To: svetter@ameritech.net
Subject: Re: Perl program transfer
Message-Id: <34B3F2BC.B54C84A9@cisco.com>
Hi,
Try this out. For unix to os/2, use \r\n as line end terminator inplace of
just \n, that will solve your problem of ^M. Replace 1,$s/ctrl+vctrl+m//g,
will replace ^M when files brought from OS/2 to UNIX.
-Amit
Scott Vetter wrote:
> I transfer Perl programs between my OS/2 system and a UNIX system.
> From OS/2 to UNIX the Perl program has a "^M" on the end of each line.
> And from UNIX to OS/2, lines run together. Is there a Perl program out
> there that will strip the "^M"'s at the end of each line and put it back
> on the OS/2 system?
------------------------------
Date: Wed, 7 Jan 1998 17:24:26 -0500
From: "Ricky Hensh" <hensh@math.msu.edu>
Subject: perLIS and $ENV{"PERLXS"}
Message-Id: <690v3l$pig$1@msunews.cl.msu.edu>
It was suggested that one could use the command
if($ENV{"PerlXS"} eq "PerlIS"){
print "HTTP/1.0 200 OK\n";
print "Content-type:text/html\n\n";
}
at the top of a script to make sure that perlIS was running instead of perl.
Is this true?
What is PerlXS? It doesn't seem to exist!
Relevant info:
IIS4.0 on WinNT4
IE4 and Netscape 4.04
MM Console setting of the default Web Site dir:
App mappings: .plx --> .../perlIS.dll
thanks
ricky
------------------------------
Date: Wed, 07 Jan 1998 15:51:04 -0600
From: Ricky <ric@megsinet.net>
Subject: problem executing getting output
Message-Id: <34B3F8C7.161ADB81@megsinet.net>
i have a script (search.cgi) written in gawk. i need to execute the
search.cgi script from a perl script. the search.cgi takes the query
data from an html form, performs the search according to this criteria
and returns the results. i need to execute this search script from my
perl script by passing it the query data from the perl script. i tried
this:
$query_string = "key=value&key=value&key=value"
$output = `search.cgi $query_string`;
but, i get an error saying that it couldn't find the posted data.(a
debugging error message hardcoded into the script) the script will
accept the form data via the GET or POST methods. i didn't write the
gawk program but i need to use it. so here's my question:
how can i pass it the needed query_string from the perl script if it
takes the data as if it were coming from a form? do i have to modify
the search script to accept the data from STDIN or something like that?
any help would be immensely appreciated as i am stumped. thanx in
advance.
ricky
------------------------------
Date: 7 Jan 1998 20:53:26 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Q: search matching "(" and ")"
Message-Id: <690q06$dvo$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Craig Berry
<cberry@cinenet.net>],
who wrote in article <690ijf$65s$2@marina.cinenet.net>:
> Ilya Zakharevich (ilya@math.ohio-state.edu) wrote:
> : > metric). Just to save you some pointless hacking, you can't do it for
> : > arbitrary levels of nesting using regexes
> :
> : Yes you can with the latest RE engine, one of the tests in t/op/pat.t
> : is doing exactly this. But this is still not "easily" - though very
> : quick. To make it "easy" several other changes to RE engine should
> : materialize first.
>
> Wow...this rather blows my mind. I'd always thought that "balanced pair
> matching" like this was beyond the scope of regexes by definition. Can
> you provide an example regex, useable under 5.004, which will match a
> sequence of characters starting with '(' and ending with the balancing
> ')', for arbitrarily nested parens?
You are confused. Perl's RE never (?) were regular-expressions per
se, since they had backreferences. 5.004_55 added new features which
move Perl's RE yet further from finite automata. Now you can insert
any Perl code in a RE.
The reference to an example is another post of this thread.
The final (?) solution to matched-paren problem will be the day when
Perl has "embedded" RE, when you will be able to do something like
$re = qr/
(?:
[^()]+
|
\( $re \)
)*
/x;
$string =~ /$re/g;
(possibly with an access to the whole complete tree).
Ilya
------------------------------
Date: 7 Jan 1998 21:38:11 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Q: search matching "(" and ")"
Message-Id: <qz$9801071621@qz.little-neck.ny.us>
Craig Berry <cberry@cinenet.net> wrote:
> Ilya Zakharevich (ilya@math.ohio-state.edu) wrote:
> : Yes you can with the latest RE engine, one of the tests in t/op/pat.t
> : is doing exactly this. But this is still not "easily" - though very
> : quick. To make it "easy" several other changes to RE engine should
> : materialize first.
> Wow...this rather blows my mind. I'd always thought that "balanced pair
> matching" like this was beyond the scope of regexes by definition. Can
It is. Beyond the scope of mathematically pure regular expressions, that
is. Pure REs don't have back references either.
> you provide an example regex, useable under 5.004, which will match a
> sequence of characters starting with '(' and ending with the balancing
> ')', for arbitrarily nested parens?
It is not in the "release" versions of 5.004, but this will be coming to
a later relase version. For now you can use 5.004_55. There is a sample
included in the test scripts for that. (I believe Ilya posted it a
while ago too, check DejaNews.)
Elijah
------
has not played with those new RE features yet
------------------------------
Date: 7 Jan 1998 21:38:57 GMT
From: "Byron Rendar" <brendar@pcc.edu>
Subject: range operator with decimal numbers
Message-Id: <01bd1bb5$03e4d1c0$532cdcc0@Baker-St.pcc.edu>
The Learning Perl book (2nd edition) states on p.49 that (1.2 .. 5.2) gives
the list (1.2, 2.2, 3.2, 4.2, 5.2). Using perl5.004_1 I tried @a = (1.2 ..
5.2); print "@a\n" and got a list of integers 1 through 5.
Is the book wrong or am I missing something?
--
Byron Rendar
brendar@pcc.edu
------------------------------
Date: Wed, 07 Jan 1998 15:51:26 -0500
From: stricherz@coaps.fsu.edu (James Stricherz)
Subject: Re: Review of CGI/Perl book
Message-Id: <stricherz-0701981551260001@aggie.coaps.fsu.edu>
In article <34B1E282.4764688D@patchett.com>, craig@patchett.com wrote:
+ And while I'm at it, Perl 4 is far from dead. It lives on as a subset of
+ Perl 5, one that is far more accessible to the beginning programmer than
+ the whole set.
This is a grave dis-service to beginning perl programmers the world over.
Since you claim that perl 4 is a subset of 5, then they can write perl 4
code that will (mostly) run under 5.
And given the subject -- CGI scripts -- let me add that perl 4 is CERTifiably
insecure. I wouldn't want it running CGI scripts on _my_ machine.
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Wed, 07 Jan 1998 15:07:56 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Running a perl script in the background on Windows(95/NT)
Message-Id: <34B3FCBC.E581BA03@mystech.com>
Mike Noel wrote:
> I've written a perl script on a Windows95/NT system that I would like to
> run and have sit in the background. The script itself does a bit of
> processing, then sleeps for 5 minutes, over and over again.
>
> I come from a UNIX background where this sort of thing is trivial but I
> can't figure out how to do it in Windows. Right now, when the script
> starts, it seems to run through a DOS window. As long as the script is
> running the DOS window is on the screen (or minimized and on the taskbar).
> If I kill the DOS window the process quits. I'd like to set up the script
> so that it doesn't use the DOS window. I don't want it to show up on the
> taskbar.
Does NT's 'start' command do what you need? I don't know about 95, though.
-----------------------------
Mark S. Reibert, Ph.D.
Mystech Associates, Inc.
3233 East Brookwood Court
Phoenix, Arizona 85044
Tel: (602) 732-3752
Fax: (602) 706-5120
E-mail: reibert@mystech.com
-----------------------------
------------------------------
Date: 7 Jan 1998 21:44:07 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: serious post about gmtime and year-1900 (was Re: Perl not Y2K compliant)
Message-Id: <qz$9801071636@qz.little-neck.ny.us>
Chip Salzenberg <chip@pobox.com> wrote:
> According to Russell Schulz <Russell_Schulz@locutus.ofB.ORG>:
> >it does all depend on the underlying C runtime supplying the correct
> >number -- and we all know there are no errors in the C runtime, right?
> Well, the C runtime is an issue with your C compiler vendor, not
> Perl's maintainers.
Yes but he'd still like to see some code in the documentation so that
you can check if perl's reliance on the underlying C is wise. I think
he should submit a test script for this to be run at 'make test' time.
Elijah
------
making such a test script platform independent should prove interesting
------------------------------
Date: Wed, 07 Jan 1998 16:13:47 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Storing A Text File Into A Variable -- How??
Message-Id: <34B3F00A.129@min.net>
Tony K. Olsen wrote:
>
> Hi Everyone,
>
> I have been struggling through a brain seizure here tonight and
> for the life of me I can't figure out how to store the output from a text
> file into a variable.
Generally speaking, text files don't produce output. ;-)
> while (<IP>) {
> chop;
> $var = $_;
> }
First off, this re-sets $var to each line of the file as you get it.
What you want is to accumulate all the lines into $var.
To do that, use .= like so:
$var .= $_;
But, are you sure you mean to strip out the newlines? If so, that's
your business...
Another way is to slurp the entire contents of the file at once, rather
that get each line and append it to the variable. By undefining $/,
<> returns the entire file as its first (and only) line:
local $/ = undef;
$var = <IP>;
close(IP);
Then, if you really don't want those newlines:
$var =~ s/\n//g;
hth,
John Porter
jporter@logicon.com
------------------------------
Date: 07 Jan 1998 16:06:11 -0500
From: Tim Gray <tim@hcirisc.cs.binghamton.edu>
Subject: Re: strangest Q you've seen regarding storing entire binary file as a hex dump in a varaible.
Message-Id: <t0iurwhu4c.fsf@hcirisc.cs.binghamton.edu>
NerveGas <NerveGas@nospam.com> writes:
> > I want a perl script to generate an html page, simple enough, but I
> > also want the perl script to generate a graphic on the page so that no
> > external file would be needed for the graphic itself.
>
> Can't do it. The browser will request an HTML page, and then the
> serve will return it. The brwoser *then* looks at the HTML, and
> requests the graphic *file* from the server, and there won't be a file
> for the server to serve. (Ikes, that was a horrible sentence). the
> closest you can come would be to convert the entire page into one large
> graphic, and simply load the graphic instead of an HTMl page, but that's
> a lot of hoops.
>
If the script were called foo.cgi and it returned the HTML when
invoked without arguments and returned the graphic when given an
argument called graphic then it should work. The HTML would need a
line like the following.
<IMG SRC="foo.cgi?graphic">
And for those who think that the SRC for an IMG needs to be an actual
file then consider most of the counters on pages out there.
------------------------------
Date: 7 Jan 1998 22:06:43 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Testing for valid RegExps?
Message-Id: <690u9j$d2$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, gbacon@adtran.com (Greg Bacon) writes:
: sub is_valid_regex {
: my $pat = shift;
: eval { local $_ = ''; /$pat/, 1 };
: }
No, sir. That zaps your //g state. local doesn't preserve that.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Tactical? TACTICAL!?!? Hey, buddy, we went from kilotons to megatons
several minutes ago. We don't need no stinkin' tactical nukes.
(By the way, do you have change for 10 million people?) --lwall
------------------------------
Date: 7 Jan 1998 22:02:43 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Trimming blanks
Message-Id: <690u23$elp$1@comdyn.comdyn.com.au>
[Removed comp.lang.perl.modules from newsgroups list. This is not a
modules question]
In article <34B415B6.4124@hotmail.com>,
canugi Yorugua <canugi@hotmail.com> writes:
> I used to "trim" strings (get rid of surrounding blanks) by using
>
> $str =~ s/^\s*(.*?)\s*$/$1/; # Get rid of surrounding blanks
>
> in our Sequent box.
> Now we have ported to a HP box and the @#!?&#&!! is not working properly
> anymore. It trims *only* blanks preceding the string but not those after
> the after.
>
> WHY!
Are the perl versions the same? This should be totally platform
independent, and the only thing I can think of that causes this would
be a perl version difference.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: 7 Jan 1998 22:12:28 GMT
From: Zenin <zenin@best.com>
Subject: Re: Unix perl shell ???
Message-Id: <884211409.9340@thrush.omix.com>
Robert Jenks <eat@joes.nospam.deli> wrote:
: Anyone written or writing a UNIX perl shell?
RTFFAQ
--
-Zenin
zenin@best.com
------------------------------
Date: Wed, 07 Jan 1998 15:19:44 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Wildcard in if ( x = a ) ?
Message-Id: <34B3FF80.335DC870@mystech.com>
Paul Ryder wrote:
> Hi,
>
> Im looking for a way of searching a number of strings and if the
> string matches the search varible, it says so.. but how can i make it
> react even if say one letter of the word is present (wildcard *) ?
>
> heres the code in question :
>
> if ($FORM{'QUERY'} =~ /$fields[0]/i)
>
> But this only picks up if the full word is present,
I'm not sure this is exactly what you want, but the consider the following
use of a character class:
$search = "dog";
$string = "hidemom";
if ( $string =~ /[$search]/i ) {
print "[$&]\n";
}
else {
print "Nope\n";
}
which prints
[d]
since the d's match. If $string = "himom", the output is
[o]
since the first match is the 'o'. Finally, if $string = "hibart", you get
Nope
-----------------------------
Mark S. Reibert, Ph.D.
Mystech Associates, Inc.
3233 East Brookwood Court
Phoenix, Arizona 85044
Tel: (602) 732-3752
Fax: (602) 706-5120
E-mail: reibert@mystech.com
-----------------------------
------------------------------
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 1597
**************************************