[15807] in Perl-Users-Digest
Perl-Users Digest, Issue: 3220 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 31 14:05:46 2000
Date: Wed, 31 May 2000 11:05:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959796318-v9-i3220@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 31 May 2000 Volume: 9 Number: 3220
Today's topics:
Re: accessing library files in a module <michalak@hwr.arizona.edu>
Re: Activestate down? <real@earthling.net>
ActiveState web site <asentell@my-deja.com>
Re: ActiveState web site <lauren_smith13@hotmail.com>
Re: Algorythm needed for copying subdirectory hierarchi (Abigail)
Re: can perl do expire page like asp (Greg Bacon)
Re: conditional ? not working as expected (Greg Snow)
Emacs modules for Perl programming (Jari Aalto+mail.perl)
Re: Embedded new lines in a comma delimited file <jeff@vpservices.com>
Re: Help on flat database.... <mark@sharewire.com>
Re: Help on flat database.... <thoren@southern-division.com>
Re: Help on flat database.... <rrauer@mitre.org>
Re: Help on flat database.... (Monte)
Re: Help reading data from file <lr@hpl.hp.com>
Re: How do I make perl flush? <mc@backwoods.org>
html retrieval and perl <john.christena@tivoli.com>
Re: html retrieval and perl <dwhaskin@earthlink.net>
Re: including CGI.pm kills the program. (Jerome O'Neil)
Is my string already in an array? <royNOroSPAM@england.com.invalid>
Re: Is my string already in an array? <lauren_smith13@hotmail.com>
Re: Is my string already in an array? nobull@mail.com
need help with LOG <aakbari@crosskeys.com>
Re: need help with LOG <dwhaskin@earthlink.net>
Re: need help with LOG <lauren_smith13@hotmail.com>
Passing parameters into a exe-ed perl script <jason@generationterrorists.com>
Re: Passing print statements nobull@mail.com
Pattern Matching question squidrocks@my-deja.com
Re: Perl Tabular -> XML <jeff@vpservices.com>
Re: Perl unusable as a programming language (Peter J Scott)
Re: perl-5.6.0 and UTF8 character weirdness (M.J.T. Guy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 31 May 2000 10:07:50 -0700
From: Zolla Michalak <michalak@hwr.arizona.edu>
Subject: Re: accessing library files in a module
Message-Id: <393546E6.C1EAE0BB@hwr.arizona.edu>
Thanks for writing. Turns out the problem was due to the method listed
incorrectly in the documentation. I was able to find the method in the code of
mapscript and found that it was queryUsingPoint() instead of queryByPoint().
I am still having library problems however. By the way, mapscript is the perl
module part of MapServer, which is used for drawing maps from map files. It was
developed at the UMN in Minnesota I believe. (I've only been using it about a
week, so I'm still learning about it myself.)
The problems I'm having now are probably due to the way it was installed. I'm
waiting to hear from the systems programmer on this.
When I open up a shell to run my program, this is the error I get:
Can't load
'/local/gnu/lib/perl5/site_perl/sun4-solaris/auto/mapscript/mapscript.so' for
module mapscript: ld.so.1: /local/bin/perl: fatal: relocation error: file
/local/gnu/lib/perl5/site_perl/sun4-solaris/auto/mapscript/mapscript.so: symbol
TIFFSwabArrayOfDouble: referenced symbol not found at
/local/gnu/lib/perl5/DynaLoader.pm line 140.
Here's the fix! I manually set the library path: setenv LD_LIBRARY_PATH
/local/tiff-3.4/lib:$LD_LIBRARY_PATH at the UNIX prompt. After that it compiles
just fine. I tried adding this line to my .login file so that I wouldn't have
to type it in every time I open up a new shell, but that hasn't worked. Here is
the line from my .login file: setenv LD_LIBRARY_PATH
/local/tiff-3.4/lib:/usr/lib:/usr/local/lib
The other possibly related problem is that mapscript will not do its job from a
web browser. My program is in the cgi-bin and works just fine on the web until
I tell it to "use mapscript," at which point it dies and gives me a system
error.
Thanks again for the suggestions. I tried use Mapscript ....doesn't compile.
The filename is mapscript.pm, lower case. It is not in the same directory, so I
tried
use the/whole/path/; and still nothing.
-zm
Michael Schlueter wrote:
> Zolla,
>
> I could not find mapscript.pm on CPAN. So my first questions are:
>
> * who wrote it?
> * where do you have it from?
> * is it properly installed via perl Makefile.PL, make, make test and make
> install ?
>
> In which library will you find mapscript.pm? Perhaps you will have to
> specify that one via:
>
> #!/usr/bin/perl -w # issue warnings
> use lib "."; # if mapscript.pm is in the same dir.
> use mapscript;
>
> else type:
>
> use lib "your_path_her";
>
> You can check the library pathes perl will use e.g. by just calling
> perl -V .
> Convention is to use uppercase for modules. So better use:
>
> Mapscript.pm
>
> Michael Schlueter
------------------------------
Date: Wed, 31 May 2000 17:11:35 +0200
From: "Real" <real@earthling.net>
Subject: Re: Activestate down?
Message-Id: <8h3a39$347$1@news.surfnet.nl>
"glauber" <glauber.ribeiroNOglSPAM@experian.com.invalid> wrote in message
news:1a8ccded.76e2198a@usw-ex0103-019.remarq.com...
> I haven't been able to access http://www.activestate.com since
> yesterday. Is it down or am i having network problems?
Been there today, about 3 hours ago. Now it seems to be gone. Perhaps they
are updating their site ?
Real
------------------------------
Date: Wed, 31 May 2000 15:01:26 GMT
From: Aaron <asentell@my-deja.com>
Subject: ActiveState web site
Message-Id: <8h39fs$b0a$1@nnrp1.deja.com>
I am trying to download the latest binary versions of Perl and the
DBI/DBD drivers for Oracle from the ActiveState web site
(www.activestate.com), but I can't get the web page to come up. Is
anybody else having this problem? Any idea what's going on?
Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 09:43:19 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: ActiveState web site
Message-Id: <8h3fh6$ebd$1@brokaw.wa.com>
Aaron <asentell@my-deja.com> wrote in message
news:8h39fs$b0a$1@nnrp1.deja.com...
> I am trying to download the latest binary versions of Perl and the
> DBI/DBD drivers for Oracle from the ActiveState web site
> (www.activestate.com), but I can't get the web page to come up. Is
> anybody else having this problem? Any idea what's going on?
No, but it looks like they just overhauled the site, you may have caught it
in a down moment.
Lauren
------------------------------
Date: 31 May 2000 16:28:35 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Algorythm needed for copying subdirectory hierarchies
Message-Id: <8h3ejj$qn9$1@news.panix.com>
On Wed, 31 May 2000 09:36:00 +0200,
Thorbjørn Ravn Andersen <thunderbear@bigfoot.com> wrote:
++ Abigail wrote:
++
++ > I won't do this in Perl, but if I had to, I would do:
++ >
++ > perl -e 'system "cd /; tar cfp - * | (cd /dest; tar xf -)"'
++
++ For generality you might want a Bp on the last tar.
You are right about the 'p', but according the man page of my tar
(Solaris x86), B is selected by default when reading from standard
input.
Abigail
------------------------------
Date: Wed, 31 May 2000 15:50:55 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: can perl do expire page like asp
Message-Id: <sjad6vhu5pj81@corp.supernews.com>
In article <8h1cjk$59q$3@news.panix.com>, Abigail <abigail@arena-i.com> wrote:
: That has as much to do with Perl as a recipe for frog legs.
Hey, great! Where can I get a good frog gig? What about good spots to
go frog gigging? :-)
Greg
--
Remember, on Linux, you don't have a choice. You get that fat
bastard every time.
-- Tom Christiansen speaking of bash
------------------------------
Date: 31 May 2000 17:02:48 GMT
From: snow@statsci.com (Greg Snow)
Subject: Re: conditional ? not working as expected
Message-Id: <8h3gjo$853$1@junior.statsci.com>
In article <8h2sq7$1a1$1@nnrp1.deja.com>,
mike cardeiro <mcardeiro@yahoo.com> wrote:
>hi
>
>I have an array @keys that has 16 elements in it.
>
>why does the following code print 20, it should(i thought) print 0
>
>(@keys < 26)?$y=0:$y=20;
>print "$y\n";
Others pointed out what your problem is, as a general suggestion
when the problem might be precedence (wrong or missing parens), you
can have perl tell you what it thinks you told it to do (you then
compare this to what you think you told it to do).
put the questionable lines in their own file (tmp.pl) then run perl as:
perl -MO=Deparse,-p tmp.pl
and it tells you how it interpreted the parens, for your example the
output is:
(((@keys < 26) ? ($y = 0) : $y) = 20);
print("$y\n");
- syntax OK
which quickly shows that perl put the parens differently than you
probably expected.
Hope this helps for the future,
--
-------------------------------------------------------------------------------
Gregory L. Snow | Inertia makes the world go round,
(Greg) | Love makes the trip worth taking.
gsnow@splus.mathsoft.com |
------------------------------
Date: 31 May 2000 15:09:26 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_959785672@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://home.eu.org/~jari/ema-keys.html
Maintainer: Jari Aalto <jari.aalto@poboxes.com>
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs
XEmacs/Emacs, is available to various platforms:
o Unix:
If you don't have one, bust your sysadm.
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
Emacs resources at http://home.eu.org/~jari/emacs-elisp.html
o W9x/NT:
http://www.gnu.org/software/emacs/windows/ntemacs.html
Emacs Perl Modules
Cperl -- Perl programming mode
.ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
.<olson@mcs.anl.gov> Bob Olson (started 1991)
.<ilya@math.ohio-state.edu> Ilya Zakharevich
Major mode for editing perl files. Forget the default
`perl-mode' that comes with Emacs, this is much better. Comes
starndard in newest Emacs.
TinyPerl -- Perl related utilities
.http://home.eu.org/~jari/tiny-tools-beta.zip
.http://home.eu.org/~jari/emacs-tiny-tools.html
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Load source code into Emacs, like Devel::DProf.pm
o Grep through all Perl manpages (.pod)
o Follow POD manpage references to next pod page with TinyUrl
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o TinyUrl is used to jump to URLs (other pod pages, man pages etc)
mentioned in POD pages. (It's a general URL minor mode)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in the tgz mentioned above]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example in the tgz (ema-tigr.ini) that shows
how to set up datatbases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to run the find for you, You can adjust
recursive grep options, ignored case, add user grep options.
You can get `igrep.el' module from <kevinr@ihs.com>. Ask for copy.
Check also ftp://ftp.ihs.com/pub/kevinr/
TinyCompile -- Browsing grep results in Emacs *compile* buffer
TinyCompile is minor mode for *compile* buffer from where
you can collapse unwanted lines, shorten the file URLs
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: Wed, 31 May 2000 14:03:49 -0400
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Embedded new lines in a comma delimited file
Message-Id: <39355405.CB3E6182@vpservices.com>
joseph_stiehm@my-deja.com wrote:
>
> Here's the solution I used, albeit without regexp. Anybody know a more
> elegant solution?
DBD::CSV handles embeddd newlines just fine. Use it to open the text
file and select all records, loop through a fetch of the records and
loop through each field of each record stripping or escaping the
newlines for each field and updating the record at the end of the record
loop. The final product will be a text file with newlines only at the
end of records.
--
Jeff
------------------------------
Date: Wed, 31 May 2000 10:55:14 -0400
From: "Mark Aisenberg" <mark@sharewire.com>
Subject: Re: Help on flat database....
Message-Id: <8h397p$51i$1@paxfeed.eni.net>
It looks like your columnar data already has delimiters
(I'd guess tabs by looking at it).
You can try:
my @items = split /\s+/,$a;
That will split the row whitespace, which includes tabs.
If you are sure you are using tabs, you could instead use:
my @items = split /\t+/,$a;
--
Mark Aisenberg <mark@sharewire.com>
http://www.sharewire.com/
Free forms, programs, and content for web sites.
No assembly required.
"Marco Castellani" <marcokast@yahoo.com> wrote in message
news:8h35sn$858$1@nnrp1.deja.com...
> Still a newbie... any help with the following problem would be
> appreciated!
>
> I have to read numbers from text files (to store them in arrays). Such
> files are organized as follow:
>
> =============
>
> [beginning of file]
> 4.6416025616 .68 .3759725 3.9137814 1.0000000 7.2423744
> 4.8397502161 .68 .3719469 3.9100652 1.0000000 7.2371278
> 5.0166785408 .68 .3690618 3.9071734 1.0000000 7.2330594
> 5.2184168152 .68 .3663531 3.9042957 1.0000000 7.2289524
> [etc...]
>
> ==============
>
> How could I read the different numbers?
>
> I know how to read ONE LINE;
> open(INF, "mydatafile.txt");
> $a = <INF>
> etc..
>
> Now, how could I say to the system where to split each row?
> Should I edit the data files and put control codes (such "pipe") bewteen
> columns (and use the "split" command on reading) ?
>
> Thanks for your attention and help ! :)
>
>
>
> --
> Marco Castellani
> Rome Astronomical Observatory
> http://www.mporzio.astro.it
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Wed, 31 May 2000 17:24:13 +0200
From: "Thoren Johne" <thoren@southern-division.com>
Subject: Re: Help on flat database....
Message-Id: <8h3as3$t87$14$1@news.t-online.com>
Marco Castellani <marcokast@yahoo.com> wrote in message
news:8h35sn$858$1@nnrp1.deja.com...
> Now, how could I say to the system where to split each row?
> Should I edit the data files and put control codes (such "pipe")
> bewteen columns (and use the "split" command on reading) ?
why don't you split it the same way than your eyes... at the whitespace
between the columns?
--
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com
------------------------------
Date: Wed, 31 May 2000 09:04:00 -0700
From: Ron Auer <rrauer@mitre.org>
Subject: Re: Help on flat database....
Message-Id: <393537F0.8EB3DE92@mitre.org>
I am a Perl "wannabie" but here is one approach.
Assume file name is passed as command line argument
#!/usr/local/bin/perl -w
while (<>) {
@array = split; #The default delimiter is white space
print $array[3], "\n"; #prints fourth number on each line e.g.,
3.9137814
}
I hope this helps.
Ron Auer
Marco Castellani wrote:
>
> Still a newbie... any help with the following problem would be
> appreciated!
>
> I have to read numbers from text files (to store them in arrays). Such
> files are organized as follow:
>
> =============
>
> [beginning of file]
> 4.6416025616 .68 .3759725 3.9137814 1.0000000 7.2423744
> 4.8397502161 .68 .3719469 3.9100652 1.0000000 7.2371278
> 5.0166785408 .68 .3690618 3.9071734 1.0000000 7.2330594
> 5.2184168152 .68 .3663531 3.9042957 1.0000000 7.2289524
> [etc...]
>
> ==============
>
> How could I read the different numbers?
>
> I know how to read ONE LINE;
> open(INF, "mydatafile.txt");
> $a = <INF>
> etc..
>
> Now, how could I say to the system where to split each row?
> Should I edit the data files and put control codes (such "pipe") bewteen
> columns (and use the "split" command on reading) ?
>
> Thanks for your attention and help ! :)
>
> --
> Marco Castellani
> Rome Astronomical Observatory
> http://www.mporzio.astro.it
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Wed, 31 May 2000 15:20:12 GMT
From: montep@about.com (Monte)
Subject: Re: Help on flat database....
Message-Id: <39382d7e.2770046@news.hal-pc.org>
On Wed, 31 May 2000 14:00:01 GMT, Marco Castellani
<marcokast@yahoo.com> wrote:
>Still a newbie... any help with the following problem would be
>appreciated!
>I have to read numbers from text files (to store them in arrays). Such
>files are organized as follow:
>=============
>[beginning of file]
> 4.6416025616 .68 .3759725 3.9137814 1.0000000 7.2423744
> 4.8397502161 .68 .3719469 3.9100652 1.0000000 7.2371278
> 5.0166785408 .68 .3690618 3.9071734 1.0000000 7.2330594
> 5.2184168152 .68 .3663531 3.9042957 1.0000000 7.2289524
>[etc...]
>==============
>How could I read the different numbers?
>I know how to read ONE LINE;
> open(INF, "mydatafile.txt");
> $a = <INF>
>etc..
>Now, how could I say to the system where to split each row?
>Should I edit the data files and put control codes (such "pipe") bewteen
>columns (and use the "split" command on reading) ?
>Thanks for your attention and help ! :)
@array = split(/ +/,$a);
However, if you were not aware of the split() function, your problem
as stated is the least problem you have. Suggest that you hie thee to
the nearest bookstore and get yourself a beginners book on Perl. (no I
will not recommend one in the NG as there are some authors in here who
consider there books to be the Rosetta's of Perl. I will let them
shamelessly hawk their own stuff. <grin>)
.
------------------------------
Date: Wed, 31 May 2000 10:25:41 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help reading data from file
Message-Id: <MPG.139eeaebfc88baa398ab09@nntp.hpl.hp.com>
In article <Pine.A41.4.21.0005310919510.13070-
100000@ginger.libs.uga.edu> on Wed, 31 May 2000 09:21:10 -0400, Brad
Baxter <bmb@ginger.libs.uga.edu> says...
...
> If you want unique words:
>
> perl -ne '$h{$_}++for split;END{print join("\n",keys%h)}'
To maintain the input order (and for a better Golf score):
perl -ne 'print map !$h{$_}++ && "$_\n", split'
or
perl -ne '$,="\n"; print grep !$h{$_}++, split'
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 31 May 2000 14:01:55 -0400
From: MC <mc@backwoods.org>
Subject: Re: How do I make perl flush?
Message-Id: <39355393.173EF856@backwoods.org>
Ok I cant resist....
Potty Train it:
use Filehandle;
TOILET->autoflush();
Swee Heng wrote:
>
> > So, how do I flush the output file (or do whatever) so diff sees a
> > fully written file?
>
> perldoc -q flush
>
> select((select(FILE_HANDLE), $|=1)[0]);
------------------------------
Date: Wed, 31 May 2000 11:28:01 -0500
From: "John Christena" <john.christena@tivoli.com>
Subject: html retrieval and perl
Message-Id: <8h3ed5$ssc$1@news.tivoli.com>
This should be simple, but I can't get it to work. I just want a CGI script
that will print out the current URL. This should work under IE and
Netscape.
I thought this should work...
use LWP::Simple;
$content = get($URL);
print "$content:";
Can somebody tell me why this variable is empty? Thx!
John
------------------------------
Date: Wed, 31 May 2000 18:03:37 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: html retrieval and perl
Message-Id: <39355360.C66CABE9@earthlink.net>
John Christena wrote:
> This should be simple, but I can't get it to work. I just want a CGI script
> that will print out the current URL. This should work under IE and
> Netscape.
>
> I thought this should work...
>
> use LWP::Simple;
> $content = get($URL);
> print "$content:";
>
> Can somebody tell me why this variable is empty? Thx!
Methinks you're confusing server-side (e.g. CGI) and client-side (e.g. user
agent) scripts.
Did you read the doc for LWP::Simple? If you're really writing a CGI script,
you probably don't want LWP::Simple and perhaps you should post your question
(more clearly) to comp.infosystems.www.authoring.cgi. Or at least look at the
faq: "perldoc -q CGI" gives several items which might help you out.
When I run the script above, it fails with the error
Not enough arguments for LWP::Simple::get
because $URL doesn't have a value.
If I modify it slightly:
perl -MLWP::Simple -e "print get('http://www.yahoo.com')"
it works as expected, and I get the raw seething HTML of Yahoo. But do you
really want this as a CGI script?
------------------------------
Date: Wed, 31 May 2000 16:14:03 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: including CGI.pm kills the program.
Message-Id: <fTaZ4.525$bR5.10269@news.uswest.net>
Chris <csorensen@uptimeresources.net> elucidates:
>
> any idea what the solution is .. I'd like to just read in all the data and
> spew it back out to sendmail.. I don't want cgi.pm limiting the amount of
> data I can accept ..
You should set the amount of data accepted to something reasonable.
use CGI;
$CGI::POST_MAX = 1024 * 4;
------------------------------
Date: Wed, 31 May 2000 09:35:16 -0700
From: Roy <royNOroSPAM@england.com.invalid>
Subject: Is my string already in an array?
Message-Id: <179d3b40.96e427e2@usw-ex0105-037.remarq.com>
Hi all.
I'm looking for the best way to check if the value of my string
is equal to any of the elements in an array. I can think of a
couple of ways of doing this, by individually checking each
element against the string, or by join-ing the array into a big
string and searching for the target string using index. However
both of these seem a little cumbersome. Is there a more
efficient way I'm missing?
Cheers.
Roy.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 31 May 2000 09:39:31 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Is my string already in an array?
Message-Id: <8h3fa2$9ca$1@brokaw.wa.com>
Roy <royNOroSPAM@england.com.invalid> wrote in message
news:179d3b40.96e427e2@usw-ex0105-037.remarq.com...
> Hi all.
Good morning...
>
> I'm looking for the best way to check if the value of my string
> is equal to any of the elements in an array. I can think of a
> couple of ways of doing this, by individually checking each
> element against the string, or by join-ing the array into a big
> string and searching for the target string using index. However
> both of these seem a little cumbersome. Is there a more
> efficient way I'm missing?
perlfaq4: How can I tell whether a list or array contains a certain element?
The FAQ is like Ragu, it's in there.
Lauren
------------------------------
Date: 31 May 2000 17:59:11 +0100
From: nobull@mail.com
Subject: Re: Is my string already in an array?
Message-Id: <u9wvkar6zk.fsf@wcl-l.bham.ac.uk>
Roy <royNOroSPAM@england.com.invalid> writes:
> I'm looking for the best way to check if the value of my string
> is equal to any of the elements in an array.
I do not believe you. You are asking that someone else do the looking
for you. If you were really looking you'd have looked in the FAQ
(where this exact qurestion appears).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 31 May 2000 11:21:00 -0400
From: Afshin Akbari <aakbari@crosskeys.com>
Subject: need help with LOG
Message-Id: <39352DDC.CBF59124@crosskeys.com>
All,
How do you generate a log file in Perl.
This isthe scnario, I have a script that
does a number of things, I need everything
to be loged while the script is running.
platform: solaris
Thanks for you help,
A.A.
------------------------------
Date: Wed, 31 May 2000 16:45:46 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: need help with LOG
Message-Id: <3935412B.50F08D0A@earthlink.net>
Afshin Akbari wrote:
> All,
>
> How do you generate a log file in Perl.
open(LOG, ">>my.log");
print LOG "Log this\n";
> This isthe scnario, I have a script that
> does a number of things, I need everything
> to be loged while the script is running.
What do you mean by "everything"? Are you trying to trace execution of
your script? Then check the perldebug documentation (particularly the
't' command or AutoTrace option).
You might get better help if you make your question a little more
explicit.
HTH,
dwh
------------------------------
Date: Wed, 31 May 2000 09:42:06 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: need help with LOG
Message-Id: <8h3feu$9kk$1@brokaw.wa.com>
Afshin Akbari <aakbari@crosskeys.com> wrote in message
news:39352DDC.CBF59124@crosskeys.com...
> All,
I'm only one according to the voices in my head.
>
> How do you generate a log file in Perl.
>
> This isthe scnario, I have a script that
> does a number of things, I need everything
> to be loged while the script is running.
perldoc -f print
perldoc -f printf
perldoc -f sprintf
and maybe:
perlfaq5: How do I print to more than one file at once?
Lauren
------------------------------
Date: Wed, 31 May 2000 23:39:45 +0800
From: "Jason Q." <jason@generationterrorists.com>
Subject: Passing parameters into a exe-ed perl script
Message-Id: <39353241.7B47020D@generationterrorists.com>
Hi there
I need to write a perl search engine which will be placed on a CD,
searching a flat-file database, and would be converting the script to an
.exe using perl2exe. My question is, how do I pass search parameters
(like search keywords) into the .exe file.
I've tried the documentation but could not seem to find this bit of
info. Would appreciate it if anybody could point me in the right
direction.
Thanks and regards,
JQ
------------------------------
Date: 31 May 2000 18:06:22 +0100
From: nobull@mail.com
Subject: Re: Passing print statements
Message-Id: <u9u2fer6nl.fsf@wcl-l.bham.ac.uk>
Ron Auer <rrauer@mitre.org> writes:
> What I would like to know - is there anyway to pass a print statment
> into the sub as a variable (of sorts).
Other people have given you answers that deal with this specific case.
However nobody seems to have pointed out that there is a totally
general way to pass arbitrary blocks of code as arguments to
subroutines - namely CODE references and anonymous subroutines.
See perldoc perlref (and perlsub).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 31 May 2000 17:15:01 GMT
From: squidrocks@my-deja.com
Subject: Pattern Matching question
Message-Id: <8h3haa$g6e$1@nnrp1.deja.com>
I'm writing a program that utilizes wgrep to retrieve a website then, in
perl, pattern match to find the correct file to be downloaded. The link
is converted into an array called @link which I then print (for testing
purposes to make sure it is correct). My problem arises because the
link taken from the webpage is in html so I need to remove all the
excess tags and such. I've figured it to be too difficult to use split
but opted towards the /.*/ which should allow me to get only the line
that starts with http and ends with exe. Since @link prints and
@truelink doesnt I'm assuming my problem is with the last lines of code.
#!/usr/local/bin/perl -w
#retrieves web page
#system ("wget http://www.nai.com/asp_set/download/dats/mcafee_4x.asp");
open (WP, "mcafee_4x.asp");
@webpage=<WP>;
close (WP); #converts webpage into array
#print @webpage;
@link=grep /superdat.english.nai.intel/, @webpage;
print @link; #used to check what link is found
@truelink=map /http.*exe/, @link;
print @truelink;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 13:54:24 -0400
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl Tabular -> XML
Message-Id: <393551D0.786E1932@vpservices.com>
Dougas Garstang wrote:
>
> Has anyone seen on CPAN a perl module which can:
>
> - Take tabular data (such as may be retrieved from a database) in plain text
> output, and based upon a DTD create an XML file?
>
> There seem to be quite a few event driven XML parsers that go the other way.
> I haven't seen anything which actually creates XML from tabular data
> however.
DBD::RAM now supports some XML operations. Its import from XML into a
database now supports many different kinds of XML. The export from a
database to XML is not as advanced yet but does support some simple
structures. Both operate from parameters passed rather than from a DTD,
i.e. you'd have to tell it which tags/columns you want and what the
relationship between them is. Both also operate on almost any kind of
tabular data whether from another DBI accessible database, or from a
variety of text file formats, or even directly from Perl arrays,
strings, or hashes.
--
Jeff
------------------------------
Date: Wed, 31 May 2000 16:10:02 GMT
From: peter@psdt.com (Peter J Scott)
Subject: Re: Perl unusable as a programming language
Message-Id: <uPaZ4.4141$F9.111817@news1.gvcl1.bc.home.com>
In article <39340f0e@news.victoria.tc.ca>,
yf110@victoria.tc.ca (Malcolm Dew-Jones) writes:
>Dan Sugalski (dan@tuatha.sidhe.org) wrote:
>: Because of some of the oddities of perl, accessing a match variable gets
>: you the value of the variable at the time you use it. So if you do this:
>
>: $bar = "abc";
>: $bar =~ /(b)/;
>: foo($1);
>
>: sub foo {
>: "abc" =~ /(c)/;
>: my $bar = shift;
>: print $bar, "\n";
>: }
>
>: it prints c, because $1 (which you unshifted off the parameter list) was c
>: at that point because of the regex match.
>
>Perhaps its just me, but that one doesn't seem that bizarre. Perl
>variables are passed by reference, and your example (implicitly) reuses a
>global variable before you make a copy of its original value.
You might want to look at
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00714.html
before concluding that there's no bizarreness associated with the scoping of $1.
--
Peter Scott
------------------------------
Date: 31 May 2000 17:41:10 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perl-5.6.0 and UTF8 character weirdness
Message-Id: <8h3irm$mjv$1@pegasus.csx.cam.ac.uk>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>
>As I said: one should not expect *anything* to work.
Sadly, in this case Ilya isn't exaggerating. Almost everything
associated with UTF8 in 5.6.0 has some (perhaps obscure) bug in it.
I'd guess that the current bleading edge Perl has about 1/3 of the
"obvious" bugs fixed and the rest are being worked on. But no
doubt there'll be more obscure bugs for some time to come.
Mike Guy
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3220
**************************************