[6913] in Perl-Users-Digest
Perl-Users Digest, Issue: 538 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 29 09:17:21 1997
Date: Thu, 29 May 97 06:00:36 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 29 May 1997 Volume: 8 Number: 538
Today's topics:
Re: Another 5.004 migration bug (Tushar Samant)
Arg. This isn't a CGI question, really it isn't. <a.j.shaw@shef.ac.uk>
Re: books (Brian Orpin)
Can I perl script download a HTML page??? (Johnathan Mark Smith)
Re: extract character from string array and use as inte (Bob Wilkinson)
Re: for loop ? (Bob Wilkinson)
HELP - Urgent - odbc information <jfarcis@ifhamy.insa-lyon.fr>
Help with CGI <jaimung@physics.ubc.ca>
Re: Help with CGI (Tad McClellan)
Re: HTTP::Daemon: How check a client has terminated? (Michael Wang)
Re: LEXICAL Scoping Hell! (explain?) (Hope this helps!)
Re: LEXICAL Scoping Hell! (explain?) (Tim Smith)
MACPERL - is it (Bohdan Peter Rekshynskyj)
Re: None (Bob Wilkinson)
Re: Perl 5.004 is available (Bohdan Peter Rekshynskyj)
Perl Online Documentation errors. kadifeli@yunus.cmpe.boun.edu.tr
Re: PERL Programmer's: What's It Like? (Scott McMahan)
Re: Problem with <> (Bob Wilkinson)
Re: PURE PERL .gif creating library needed; not in @#$ <joshua@mongoose.demon.co.uk>
Script to access micros. works database <ulsass@berlin.snafu.de>
Re: Search results problem is making me crazy (Clay Irving)
Slices of lists (Brian Orpin)
Re: String comparsion (Honza Pazdziora)
STYLE: subclass method names (Tim Smith)
track user <102646.1641@CompuServe.COM>
Re: undef, split: bug? <good.luck@getting.spam.to.zenin.at.best.com>
Re: undef, split: bug? <fred@lovelace.infobiogen.fr>
Re: What does main' in sub main'routine do? (Honza Pazdziora)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 May 1997 01:47:03 -0500
From: scribble@shoga.wwa.com (Tushar Samant)
Subject: Re: Another 5.004 migration bug
Message-Id: <5mj8p8$qis@shoga.wwa.com>
In article <338CE224.3569@ixlabs.com>,
Chris Schoenfeld <chris@ixlabs.com> wrote:
>Never mind, I figured it out - it's perltie gotcha related.
>
>In my own defense, the new Perl manpages were not correctly installed,
>so I was reading old ones!
Hope this helps!
------------------------------
Date: Thu, 29 May 1997 12:19:37 +0200
From: Andy Shaw <a.j.shaw@shef.ac.uk>
Subject: Arg. This isn't a CGI question, really it isn't.
Message-Id: <338D5839.167E@shef.ac.uk>
I would like to be able to test my cgi programs on my stand-alone pc at
home, without having to set up the ENV{"QUERY_STRING"} and similar each
time I do it. I would really like to have a program which would act like
httpd, but I don't have the network services to use one. Any Ideas on
programs/scripts/daemons I can use to make my PC pretend to be networked
to itself?
TIA
Andy Shaw
------------------------------
Date: Thu, 29 May 1997 12:06:14 GMT
From: brian.orpin@gecmX.com (Brian Orpin)
Subject: Re: books
Message-Id: <339570e9.18167815@news.geccs.gecm.com>
On Wed, 28 May 1997 16:17:06 -0700, Pierre Merle <pmerle@corp.sun.com>
wrote:
>Maybe two separates books are better, I use perl by exemple by
>Ellie Quipley and HTML for fun and profit.
>First is good but only perl, second is old and too simple.
>What about Oreilly books ?
>
IMHO O'Reilly books are the best resources anyone could buy.
--
Brian Orpin (These thoughts are my own ......... for once!)
brian.orpin@gecmX.com or BrainOrpin@BigfootX.com
http://www.borpin.demon.co.uk/ **Anti-spam reply-to remove X**
------------------------------
Date: Thu, 29 May 1997 12:39:13 GMT
From: smithj@statenislandonline.com (Johnathan Mark Smith)
Subject: Can I perl script download a HTML page???
Message-Id: <338d78e9.4032899@news.tiac.net>
Can I perl script download a HTML page???
Please Email me back
------------------------------
Date: Wed, 28 May 1997 14:33:50 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: extract character from string array and use as integer
Message-Id: <b.wilkinson-2805971433500001@ip57-york.pindar.co.uk>
In article <5mfpmt$pch$1@news8.gte.net>, ddougal@concentric.net (David
Dougal) wrote:
>
> @array = ("w0123456789","l0123456787","w0134265879", "t0123456789",
> "w0123456789", "w0123456789");
>
> How can I extract the third character from one of the string elements
and then
> use the character as an integer?
Hello,
Try
my $index = 2; # or 0, 1, 3, 4, 5. You have to decide which element you want!
my $integer = substr($array[$index],2,1)
--
I have become death, destroyer of the worlds.
------------------------------
Date: Wed, 28 May 1997 14:43:46 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: for loop ?
Message-Id: <b.wilkinson-2805971443460001@ip57-york.pindar.co.uk>
In article <slrn5ohg7c.2qr.jahwan@supernova.math.lsa.umich.edu>,
jahwan@supernova.math.lsa.umich.edu (Jahwan Kim) wrote:
> > In article <337C6922.396@mathematica-mpr.com>
> > the count <eglamkowski@mathematica-mpr.com> writes:
> >
> > > if you want something like:
> > > for (; $x > 0; $x--)
> > >
> > > can you shorten it to:
> > > for ($x .. 1)
> > > ?
>
> foreach $x (reverse 1 .. $x)
>
> Jahwan
Hello,
I'm not too sure that it is advisable to use the same variable as both
the iterator and the limit inside a loop. It may work OK but it looks very
wobbly to me.
Bob
--
I have become death, destroyer of the worlds.
------------------------------
Date: Thu, 29 May 1997 11:57:25 +0200
From: Jeremie FARCIS <jfarcis@ifhamy.insa-lyon.fr>
Subject: HELP - Urgent - odbc information
Message-Id: <338D5305.1000@ifhamy.insa-lyon.fr>
Hello!
I would like to use win32::odbc on a DEC ALPHA platform. For this, i
have downloaded the alpha_odbc.pll file on ftp.roth.net/pub/ntperl/. But
this pll file do not seem to work with
any odbc release... I always get a 'parse exception' !!
Please, could you tell me :
* with what release of the win32::odbc package it runs (i
have tryed the 960722, 961105, and 970208 versions)
* with what build of perl i can use it (i have tried 110, 304
and 306).
Thank you for your help !
Jeremie
jfarcis@ifhamy.insa-lyon.fr
------------------------------
Date: Wed, 28 May 1997 15:41:52 -0700
From: Sebastian <jaimung@physics.ubc.ca>
Subject: Help with CGI
Message-Id: <338CB4B0.18EC@physics.ubc.ca>
Hi Group,
I'm not sure if this is the right to place ask -- but I couldn't think
of another group. I'm setting up a web server on my home computer (I
have a direct ISDN connection), and I'm using WebSite Server for Win95.
I am trying to write some CGI scripts, I have no problem with the
scripts themselves... the problem is in geting the link to work for PERL
programs. Executables and DOS-scripts work fine with the following SSI
<!--#exec cgi="/cgi-bin/program.exe" -->
But the following fails.
<!--#exec cgi="/cgi-bin/program.pl" -->
(i belive) for some reason the perl interpretor is not being loaded to
run the script. I would really like some help with this.
Thanks,
Seb.
------------------------------
Date: Thu, 29 May 1997 06:24:49 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help with CGI
Message-Id: <12pjm5.mn.ln@localhost>
Sebastian (jaimung@physics.ubc.ca) wrote:
: Subject: Re: Help with CGI
^^^
^^^
: Hi Group,
: I'm not sure if this is the right to place ask -- but I couldn't think
^^^^^^^^^^^^^^^^^^
: of another group.
How about a newsgroup whose name contains a word from your Subject: header?
comp.infosystems.www.authoring.cgi
-----
"_think_ of another group"??
There are 10's of thousands of newsgroups! You can't remember them all
(well, I can't anyway).
Stash a list of them in your 'puter so you can wordsearch them
when you need to find a newsgroup. Finding such a list is beyond
the scope of this article ;-)
: I'm setting up a web server on my home computer (I
^^^^^^
How about a newsgroup whose name contains a word from your problem statement?
comp.infosystems.www.servers.mac
comp.infosystems.www.servers.misc
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.servers.unix
: have a direct ISDN connection), and I'm using WebSite Server for Win95.
^^^^^
comp.infosystems.www.servers.ms-windows then.
: I am trying to write some CGI scripts, I have no problem with the
: scripts themselves...
So you don't have a Perl problem.
So this is not the place to ask ;-)
: the problem is in geting the link to work for PERL
: programs. Executables and DOS-scripts work fine with the following SSI
: <!--#exec cgi="/cgi-bin/program.exe" -->
: But the following fails.
: <!--#exec cgi="/cgi-bin/program.pl" -->
: (i belive) for some reason the perl interpretor is not being loaded to
: run the script. I would really like some help with this.
If you need help with setting up a server, then ask in a server
newsgroup where people who know about that hang out.
Perl doesn't have a "server".
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 29 May 1997 03:35:17 -0700
From: mwang@lithos.pandadesigns.com (Michael Wang)
Subject: Re: HTTP::Daemon: How check a client has terminated?
Message-Id: <5mjm55$afg@lithos.pandadesigns.com>
In article <3385EF53.3FD3@blacksun.com>,
Michael Schilli <mschilli@blacksun.com> wrote:
>I use HTTP::Daemon and fork another process in order to communicate with
>a client. But since clients can suddenly point their browsers somewhere
>else, the connection can be terminated. In such a case, on the server
>side, I would like to terminate the (spawned) process, as soon as I know
>the client is no longer there. How can I check that?
If you try to write to a socket that's been closed on the other end a
SIGPIPE is generated, which is easy enough to trap with a signal
handler.
Michael Wang
mwang@pandadesigns.com
------------------------------
Date: 29 May 1997 01:43:11 -0500
From: scribble@wwa.com (Hope this helps!)
Subject: Re: LEXICAL Scoping Hell! (explain?)
Message-Id: <5mj8hv$q6m@shoga.wwa.com>
Keywords: lexical
In article <5mih6e$pgh@newsworthy.West.Sun.COM>,
Jason Fish - SunEducation <jason@Sun.COM> wrote:
> [...] I know what is going on, but it seems
>to 'break' what is said about the lexical-ness of my() variables.
It doesn't. What's said about a my variable is: it doesn't
in any way perturb the *outside* of its block. That's all.
A subroutine call counts as outside, for obvious reasons.
Why would an inner block be "outside"? It makes no sense.
># Problem: "my" variables seems to behave as "locals" when a 'child'
># block executes its code. That is, my variables are visible
># within 'child' blocks.
>
># If the "BLOCKS" are replaced by subroutines, and called,
># the scoping of my works.
That's lexical scoping.
------------------------------
Date: 29 May 1997 02:42:51 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: LEXICAL Scoping Hell! (explain?)
Message-Id: <5mjj2r$s25@web.azstarnet.com>
Keywords: lexical
- CC'd to poster -
In article <5mih6e$pgh@newsworthy.West.Sun.COM>,
Jason Fish - SunEducation <jason@Sun.COM> wrote:
># Problem: "my" variables seems to behave as "locals" when a 'child'
># block executes its code. That is, my variables are visible
># within 'child' blocks. I'm confused by this. my variables
># are lexically scoped, available only to the block they are
># created in, or so say the manuals, etc.
>#
># What's going on here?
>#
># If the "BLOCKS" are replaced by subroutines, and called,
># the scoping of my works.
Jason,
'Child' blocks are still within 'parent' blocks, and lexical variables
from the 'parent' blocks are still visible inside the 'child' blocks.
Since subroutines are defined outside of the 'parent' blocks ('parent'
doesn't apply - they are 'peer' blocks, if you will), the lexical variables
are NOT visible inside the subroutine blocks. Maybe an example will help:
#!/usr/bin/perl -w
my $var0 = 'VAR0';
A: {
print "A:\tVar0 (", \$var0, "): $var0\n";
$var1 = 'VAR1'; # XXX
print "A:\tVar1 (", \$var1, "): $var1\n"; # XXX
my $var1 = 'var1';
print "A:\tVar1 (", \$var1, "): $var1\n";
my $var2 = 'var2';
print "A:\tVar2 (",\$var2, "): $var2\n";
}
B: {
print "B:\tVar0 (", \$var0, "): $var0\n";
print "B:\tVar1 (", \$var1, "): $var1\n"; # XXX
local($var1) = 'vAR1';
print "B:\tVar1 (", \$var1, "): $var1\n"; # XXX
print "B:\tVar2 ",
(defined $var2
?
"(" . \$var2 . "): $var2"
:
'UNDEFINED'),
"\n";
}
print "File:\tVar0 (", \$var0, "): $var0\n";
print "File:\tVar1 (", \$var1, "): $var1\n"; # XXX
print "File:\tVar2 ",
(defined $var2
?
"(" . \$var2 . "): $var2"
:
'UNDEFINED'),
"\n";
__END__
circle:~/prog/tmp$ ./lexical.pl
A: Var0 (SCALAR(0x72e10)): VAR0
A: Var1 (SCALAR(0x72ea0)): VAR1
A: Var1 (SCALAR(0x72eb8)): var1
A: Var2 (SCALAR(0x72f00)): var2
B: Var0 (SCALAR(0x72e10)): VAR0
B: Var1 (SCALAR(0x72ea0)): VAR1
B: Var1 (SCALAR(0x72048)): vAR1
B: Var2 UNDEFINED
File: Var0 (SCALAR(0x72e10)): VAR0
File: Var1 (SCALAR(0x72ea0)): VAR1
File: Var2 UNDEFINED
circle:~/prog/tmp$
$var0 is visible everywhere, including 'child' blocks. It would not
be visible from another file, though (another module could not reference
$main::var0). $var1 is visible from another file, however - it's a
'global' or 'package' variable.
Notice that, on the lines marked with # XXX, each $var1 is actually
$main::var1 (and would need to be specified as such under 'use strict').
On the lines marked with # ZZZ, 'use strict' will cause an error because
$var2 is not qualified with a package and is not lexically scoped. You
might try using $main::var2, but you really want something like
$main::?A?::var2, but there is no syntax to access block A's $var2, because
it no longer exists once you're outside of block A.
I hope this clears things up a bit, and doesn't confuse too much.
Tim
------------------------------
Date: Thu, 29 May 1997 06:55:00 -0400
From: FAQ-NOT-FOR-EMAIL@Tryzub.com (Bohdan Peter Rekshynskyj)
Subject: MACPERL - is it
Message-Id: <FAQ-NOT-FOR-EMAIL-2905970655000001@bohdan.dialup.access.net>
still alive?
I see the last updates (perl.com) around July of last year...
Is there a MacPerl email list?
Thanks!
Bohdan
PS - please email me at Bohdan@TRYZUB.com - I do not have
daily access here. Thanks! 8-)
------------------------------
Date: Wed, 28 May 1997 14:45:52 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: None
Message-Id: <b.wilkinson-2805971445520001@ip57-york.pindar.co.uk>
In article <199705271310.PAA25986@cleopatre.pasteur.fr>,
pbouige@pasteur.fr (Philippe Bouige) wrote:
> help
Hello,
What is wrong??
Bob
--
I have become death, destroyer of the worlds.
------------------------------
Date: Thu, 29 May 1997 06:51:01 -0400
From: FAQ-NOT-FOR-EMAIL@Tryzub.com (Bohdan Peter Rekshynskyj)
Subject: Re: Perl 5.004 is available
Message-Id: <FAQ-NOT-FOR-EMAIL-2905970651010001@bohdan.dialup.access.net>
That's nice.
But what about the Macintosh?
Bohdan
In article <5lsogb$m4l$1@nadine.teleport.com>, chip@rio.atlantic.net (Chip
Salzenberg) wrote:
> The Perl development team is pleased to announce the release of Perl 5.004.
>
> You should be able to install and use this release of Perl under almost all
> families, mutations, and imitations of UNIX, as well as VMS, OS/2, QNX,
> LynxOS, AmigaOS, Plan 9, and Windows NT. If this release of Perl is built
> under Windows NT, it can also be used under Windows 95.
>
> It is *vital* that you read the file "INSTALL" before building this
> release; it contains information you absolutely need to know. For example,
> "INSTALL" explains how you can install Perl 5.004 without removing previous
> version(s) of Perl, and how you can make Perl 5.004 binary-compatible with
> Perl 5.003 (and why you have a choice).
>
> There are several new functions and features in Perl 5.004, including a
> small number of unavoidable incompatibilies. See the change notices for
> details, in the file "pod/perldelta.pod". It is *highly* recommended that
> you read "pod/perldelta.pod" before using this release if you have any
> previous experience with Perl.
>
> If you find a bug, please report it to us with the "perlbug" script in the
> "utils" directory of the distribution. Since you may have older versions
> of "perlbug" installed, run it as "./perl utils/perlbug"; to display its
> documentation, use the "-h" flag. If you cannot send external E-Mail from
> your development platform, you can still use "perlbug" to prepare the bug
> report and save it to a file, which you should then mail to
> <perlbug@perl.com>.
>
> If Perl didn't even compile, then you won't be able to use "perlbug".
> Instead, compose your bug report by hand, being sure to include the output
> of the "myconfig" shell script included in the distribution, and mail it to
> <perlbug@perl.com>.
>
> We re-emphasize: *Please* read "INSTALL" and "pod/perldelta.pod". We are
> happy to answer questions, but our time is limited. By reading the
> excellent documentation included with Perl before asking for help, you will
> save yourself time, you will save us time, and you will help us debug the
> documentation.
>
> NOTE: One user-visible bug in Perl 5.004 was found between the creation of
> Perl 5.004 and its announcement. A bug fix will be posted separately.
>
> You will find this release on CPAN, the Comprehensive Perl Archive Network.
> The following URL at Tom Christiansen's web server (perl.com) will
> automatically direct your request to a CPAN FTP site appropriate for your
> location:
>
> http://www.perl.com/CPAN/src/5.0/perl5.004.tar.gz
>
> If you wish to retrieve the file entirely with HTTP, you can use this URL
> at The Perl Institute (perl.org):
>
> http://www.perl.org/CPAN/src/5.0/perl5.004.tar.gz
>
> Finally, to quote Douglas Adams: "Share and enjoy!"
>
> Signed,
>
> The Perl Development Team
>
> --
> Chip Salzenberg - a.k.a. - <chip@pobox.com>
> "Most organizations reward individuals and groups that
> choose to re-invent the wheel." -- Bjarne Stroustrup
------------------------------
Date: Thu, 29 May 1997 07:35:53 -0600
From: kadifeli@yunus.cmpe.boun.edu.tr
To: kadifeli@mercan.cmpe.boun.edu.tr
Subject: Perl Online Documentation errors.
Message-Id: <864907977.10901@dejanews.com>
I downloaded the Perl Online Documentation as "a giant tarfile of all
the HTML pages" (namely, PerlDoc-5.004beta-html.tar.gz). It looks like
the nmanual/pod/perlfunc/ directory does not contain the necessary HTML
files. (It has only a file called X.html). Where are the other files?
Does anybody know a place where I can find an official non-beta (such as
5.003) documentation for Perl 5?
--
| Fedon Kadifeli, Pamukbank T.A.S., Istanbul, Turkey. [ +-- | / ]
| http://yunus.cmpe.boun.edu.tr/~kadifeli/ [ +-- |X ]
| mailto:kadifeli@yunus.cmpe.boun.edu.tr [ | .| \. ]
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 29 May 1997 12:23:43 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: PERL Programmer's: What's It Like?
Message-Id: <5mjsgf$555$1@mainsrv.main.nc.us>
Jerome Bradenbaugh (bradenb@ibm.net) wrote:
: I'm considering working as a PERL programmer. Please explain what that
: involves.
It's like this: You one day come to the realization you don't need to
use unnecesary apostrophes, and then you are happy.
Scott
------------------------------
Date: Wed, 28 May 1997 14:25:31 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Problem with <>
Message-Id: <b.wilkinson-2805971425310001@ip57-york.pindar.co.uk>
In article <338B342D.41C6@cems.umn.edu>, Bruce Bromberek
<bromberek@cems.umn.edu> wrote:
> I'm writing a script to process datafiles
>
> while($filename = <*.dat>)
>
> will return every file in the current directly that matches the above
> pattern *.dat
>
> I tried to be sneaky and make the pattern a command line option
>
> $pat = $ARGV[0];
>
> but I found that
>
> while($filename = <$pat>)
>
> will return only the first match.
>
> What am I missing?
>
> Bruce Bromberek
Hello,
From turquoise Camel pp. 55 "If the string inside the angle brackets is
anything other than a filehandle name or a scalar variable (evene if there are
extra spaces), it is interpreted as a filename pattern to be 'globbed'"
So what you have now is a scalar variable, what you had before was a
pattern which was "globbed".
Bob
--
I have become death, destroyer of the worlds.
------------------------------
Date: Thu, 29 May 1997 10:37:05 +0100
From: Joshua <joshua@mongoose.demon.co.uk>
To: Alexander Petrosyan <paf@fbit.msk.su>
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules. PERL!
Message-Id: <338D4E41.1C27@mongoose.demon.co.uk>
Alexander Petrosyan wrote:
>
> I'm looking for a PURE PERL library of manipulating GIF images.
> Perl, Perl and only Perl.
> Without patching perl sources / attaching external C language libraries.
>
I do not know of a full library for doing GIF images, but I have
written the program you describe. Regrettably I am neither a
professional Perl programmer nor a hacker, but it does function
properly on all of the servers I have to deal with.
Take a look at:
http://www.mongoose.demon.co.uk/perlctr.html
--
Joshua Swink
joshua@mongoose.demon.co.uk
------------------------------
Date: Thu, 29 May 1997 12:07:33 +0200
From: "Markus Ulsa_" <ulsass@berlin.snafu.de>
Subject: Script to access micros. works database
Message-Id: <338D5565.BB04AB2@berlin.snafu.de>
Hi !
I'm looking for a script/ module to access a database like microsft
works or excel - or if it is easier to extract - from an .csv-file.
Markus
------------------------------
Date: 29 May 1997 08:57:49 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Search results problem is making me crazy
Message-Id: <5mjuge$ia2@panix.com>
In <338ca08a.14828565@news.hal-pc.org> schaer@[204.52.135.1] (A. M. Schaer) writes:
>#!/usr/bin/perl
>I am trying to get Perl to write *only* lines matching a specified
>pattern to a file. What is happening when I run the script is that
>*all* the lines in the input file get written to the output file. I'm
>obviously missing something.
>This is the script:
>$infile="practice.txt";
>$outfile="temp.txt";
>$pattern=/marker/;
> grep ($pattern, $infile > $outfile);
>open (IN, "practice.txt") || die "Can't open practice.txt: $!";
>@hits = grep (/$pattern/, <IN>);
What's the value of $pattern?
#!/usr/local/bin/perl5.003 -w
$pattern=/marker/;
print "The value of \$pattern is: $pattern\n"; # What's in $pattern?
# Let's try this:
$good_pattern = "marker";
print "The value of \$good_pattern is: $good_pattern\n";
When I run this program, I get:
Use of uninitialized value at ./foo2.pl line 3.
The value of $pattern is:
The value of $good_pattern is: marker
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: Thu, 29 May 1997 12:34:49 GMT
From: brian.orpin@gecmX.com (Brian Orpin)
Subject: Slices of lists
Message-Id: <339671cd.18396087@news.geccs.gecm.com>
As a newcomer to Perl I have hit my first (apparently) insurmountable
problem which on line help (The downloaded HTML man pages are broken
but that's another thread) hasn't and is beyond 'Learning Perl' (what
a great starter).
I wish to replace a slice of an array.
I used a grep to find if the item (string) exists in the array but
could not find a function to tell me it's position other than by going
through the array and incrementing a counter. Is there a better way?
So I can find the start and end points of the slice I want to remove.
@new = @old[$start..$end];
However, how do I replace the slice with a different array e.g. or
even delete those elements I have identified.
@old = ("one", "two", "three");
@new = ("twoa", "twob");
to get an array ("one", "twoa", "twob", "three")
All help gratefully received.
--
Brian Orpin (These thoughts are my own ......... for once!)
brian.orpin@gecmX.com or BrainOrpin@BigfootX.com
http://www.borpin.demon.co.uk/ **Anti-spam reply-to remove X**
------------------------------
Date: Thu, 29 May 1997 08:56:55 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: String comparsion
Message-Id: <adelton.864896215@aisa.fi.muni.cz>
"Alexander K. M. Leung" <kmleung@fg702-6.abct.polyu.edu.hk> writes:
> Hi,
>
> I want to use Perl to develop a small utility in my SGI workstaiton. Such
> utility will have a menu with 3 options (A, B, C). How can I use a if
> statement to detect which option is chosen.
>
> I have try the following script, but it is not work.
>
> $option=<STDIN>
chomp $option;
> if ($option="a") {
eq
> :
> } elsif ($option="b") {
eq
> :
> } elsif ($option="c") {
eq
> :
> }
>
> How can I modify this script? Thanks.
The read from STDIN has the newline (\n) character appended, so you
need to strip it off.
When you are compering strings, you need string comparing operator (eq),
as opposed to numeric comparison (==). Anyway, single equal sign (=)
would assing, not compare.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 29 May 1997 01:50:31 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: STYLE: subclass method names
Message-Id: <5mjg0n$j80@web.azstarnet.com>
I made a test class called CommentMunger that inherits from HTML::Parser.
I want to add methods to CommentMunger so that one can write:
$cm = new CommentMunger "$outfile";
$cm->write "text";
But I don't want to use sub write { ... } because it might be used in
HTML::Parser some day and cause a conflict. I decided to use a prefix,
such as:
$cm->CM_write "text";
But that can get ugly, and I'm wondering if there's a smoother way of
reducing the chance that a subclass method will conflict with a
superclass method.
Thanks,
Tim
------------------------------
Date: 25 May 1997 14:30:14 GMT
From: richard ferry <102646.1641@CompuServe.COM>
Subject: track user
Message-Id: <5m9idm$f40$1@mhafn.production.compuserve.com>
we are instituting a chargeback feature on our intranet server.
is there a way to track a user coming in from an ip address and
find out how long he has been on our server until he signs off ?
thanks in advance
------------------------------
Date: 29 May 1997 10:32:40 GMT
From: Zenin <good.luck@getting.spam.to.zenin.at.best.com>
Subject: Re: undef, split: bug?
Message-Id: <5mjm08$pse$1@nntp2.ba.best.com>
Frederic Achard <fred@lovelace.infobiogen.fr> wrote:
> Dear all,
> The following perl code
> " $ perl5.004 -e ' ( undef, undef, $a) = split / /, "1 2 3"; print " $a\n"'
> "
> prints only the new line
> The previous perl version returned what I'd expect:
> " $ perl5.003 -e ' ( undef, undef, $a) = split / /, "1 2 3"; print " $a\n"'
> " 3
> This looks pretty much like a bug to me. Unless I have been miss-using
> split and undef for months :-(
Ya, me too. Here's even more odd stuff along the same lines:
$ perl5.004 -e '($b, $c, $a) = split / /, "1 2 3"; print " $a\n"'
3
Looks good, but what about:
byron@thrush $ perl5.004 -e '($b, undef, $a) = split / /, "1 2 3"; print " $a\n"'
3
Still looks good, but what about:
byron@thrush $ perl5.004 -e '(undef, $a, undef) = split / /, "1 2 3"; print " $a\n"'
2 3
Huh??? Where did that 3 come from???
It did work ok with 5.003:
$ perl5.003 -e '(undef, $a, undef) = split / /, "1 2 3"; print " $a\n"'
2
perl5.004 -V
Summary of my perl5 (5.0 patchlevel 4 subversion 0) configuration:
Platform:
osname=freebsd, osvers=2.2.1-release, archname=i386-freebsd
uname='freebsd thrush.omix.com 2.2.1-release freebsd 2.2.1-release #0: mon may 19 20:48:33 pdt 1997 root@thrush.omix.com:usrsrcsyscompilethrush i386 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio= d_sfio=
Compiler:
cc='pgcc', optimize='-O2', gccversion=2.7.2p
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='char', d_stdstdio=, usevfork=true
voidflags=15, castflags=0, d_casti32=, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, randbits=31
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-lgdbm -lm -lc -lcrypt
libc=/usr/lib/libc.so.3.0, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=define, ccdlflags=' '
cccdlflags='-DPIC -fpic', lddlflags='-Bshareable -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under freebsd
Compiled at May 21 1997 18:38:54
@INC:
/usr/local/lib/perl5/i386-freebsd/5.004
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/i386-freebsd
/usr/local/lib/perl5/site_perl
.
-Zenin
zenin @ best . com
------------------------------
Date: 29 May 1997 12:48:04 +0200
From: Frederic Achard <fred@lovelace.infobiogen.fr>
Subject: Re: undef, split: bug?
Message-Id: <wvg1v6eeqj.fsf@lovelace.infobiogen.fr>
Zenin <good.luck@getting.spam.to.zenin.at.best.com> writes:
>
> Frederic Achard <fred@lovelace.infobiogen.fr> wrote:
[snip]
>
> > This looks pretty much like a bug to me. Unless I have been miss-using
> > split and undef for months :-(
>
> Ya, me too. Here's even more odd stuff along the same lines:
>
> $ perl5.004 -e '($b, $c, $a) = split / /, "1 2 3"; print " $a\n"'
> 3
> Looks good, but what about:
>
>
> byron@thrush $ perl5.004 -e '(undef, $a, undef) = split / /, "1 2 3"; print " $a\n"'
> 2 3
> Huh??? Where did that 3 come from???
> It did work ok with 5.003:
> $ perl5.003 -e '(undef, $a, undef) = split / /, "1 2 3"; print " $a\n"'
> 2
>
No good :-(, at all! As I have been suggested, I sent my exemple to
perlbug. Hope we'll get some feedbacks soon.
--
-- frederic
------------------------------
Date: Thu, 29 May 1997 08:59:26 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: What does main' in sub main'routine do?
Message-Id: <adelton.864896366@aisa.fi.muni.cz>
dinh@yi.cs.ucla.edu (Dinh Le) writes:
> Hi,
>
> I am trying to debug a perl program that declared a subroutine as:
>
> sub main'routine {
> <BODY>
> }
>
> In a different file, the subroutine main'routine is referred to
> as &routine. Can someone tell me the purpose behind the prefix
> main'?
It's the package identifier, in newer versions of Perl you can see
them as main::. Identifier goes into main package, unless otherwise
statted.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
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 538
*************************************