[6905] in Perl-Users-Digest
Perl-Users Digest, Issue: 530 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 28 03:09:13 1997
Date: Wed, 28 May 97 00: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 Wed, 28 May 1997 Volume: 8 Number: 530
Today's topics:
Re: any editor for perl?--any editor written in Perl? (Jahwan Kim)
Re: any editor for perl? (Mark Mills)
Re: any editor for perl? (Koos Pol)
Re: any editor for perl? (Steve Lamb)
Re: AWK vs Perl For Misc Data Processing Tasks (Andrew M. Langmead)
Data::Dumper, err, DynaLoader under HPUX 9.x (Ashton)
Re: extract character from string array and use as inte (Tad McClellan)
Re: extracting columns (Tung-chiang Yang)
Re: extracting columns (Tushar Samant)
Re: extracting columns <flg@vhojd.skovde.se>
Re: Help with delimited fields... <mgjv@comdyn.com.au>
Re: I'm having problems with my "here document" syntax (Andrew M. Langmead)
Re: Is it possible to access Microsoft SQL databases wi <billc@tibinc.com>
listing of Filenames under a directory <chchee@iti.gov.sg>
LWP and SIG traps not playing well together! <chris@ixlabs.com>
Re: Magical Auto-increment operator (Tushar Samant)
Re: newbie - perl modules (Bob Wilkinson)
Re: OS/2: Locales / I18N problem: What to do? (Koos Pol)
Perl 5 CGI on Win95, How? " mickeyc"@amgen.com
perl newbie stuck!! <sage@ans.com.au>
Re: Problem with <> (Andrew M. Langmead)
Re: PURE PERL .gif creating library needed; not in @#$ (Abigail)
Random number problem brennan@byte-back.com
Re: Random number problem (Tung-chiang Yang)
Re: RCS-style version mgmt implementation in Perl? (Bob Wilkinson)
Re: RegExp tutorial suggestions? (Faust Gertz)
Re: rounding floats /mlml (Tad McClellan)
Re: using getopt or getopts function (Nathan V. Patwardhan)
Who am I? (I'm a perl script) (Peter Marks)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 May 1997 06:53:01 GMT
From: jahwan@supernova.math.lsa.umich.edu (Jahwan Kim)
Subject: Re: any editor for perl?--any editor written in Perl?
Message-Id: <slrn5onlid.83p.jahwan@supernova.math.lsa.umich.edu>
Since we're on the subject, is there any editor written in Perl?
Anyone?
Jahwan
------------------------------
Date: Wed, 28 May 1997 06:09:42 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: any editor for perl?
Message-Id: <338dc951.3779553@news.ntr.net>
On Tue, 27 May 1997 22:49:27 +0800, ccm <biceps@hkstar.com> wrote:
>I am a new user in Perl.
>I found that those .pl files edited under Win95/Dos Editor will not work
>properly.
>But if I edit them in the unix shell with pico, they works fine.
>is out there any editor which workable with perl under Win95/Dos
>Environment?
Any text editor will do. What you need to do is stop ftp'ing the
files in BINary mode. Make sure you move them back and forth in ASCII
text mode. If you are zip'ing them, stop. This will drive you nuts
till you figure it out. :> Wait till you move them to mac machines
too. I sorted this all out without hints late on night. If it had
gone another five minutes or so I might still be in a corner slowly
ripping a newspaper into neat 1/2 centimeter square bit while humming
the theme to Fame. =}
In 95 I use notepad (or wordpad, which can actually handle unix format
text files if you have them, but still, use ASCII mode...)
In unix I use vi(m) because some people put more than 255 chars on a
line and pico truncates without warnings! <-- not good for perl! Of
course if you are copying work from someone that stupid then maybe you
deserve that...
In dos I suppose edit would do, unless you are partial to *shudder*
edlin and other forms of mortal torture.
In mac I hear teachtext is adequate if it is a onetime thing.
HTH
> SubSpace SquadSite: http://www.blackdragon.org/
Kewl, SubSpace...
--
Mark <mark@ntr.net>
Zaphod Beeblebrox: It's the weird color-scheme that freaks me. Every time
you try to operate one of these weird black controls, which are labeled
in black on a black background, a small black light lights up black to
let you know you've done it!
------------------------------
Date: 28 May 1997 06:13:53 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Re: any editor for perl?
Message-Id: <5mgif1$5fs@news.nl.compuware.com>
In <338AF477.FE11738D@hkstar.com>, ccm <biceps@hkstar.com> writes:
>I am a new user in Perl.
>I found that those .pl files edited under Win95/Dos Editor will not work
>properly.
>But if I edit them in the unix shell with pico, they works fine.
>is out there any editor which workable with perl under Win95/Dos
>Environment?
>
>Pls help.
>
>--
I use FTE from Marko Macek. I has some peculiarities but is is *very*
powerful, several ports are available and it has syntax highlighting for
perl, rexx, html, java,sh,ada, etc.
Check http://ixtas.fri.uni-lj.si/~markom/fte
Koos Pol
----------------------------------------------------------------------
S.C. Pol
PC Systems Administrator
Compuware Europe B.V.
email: Koos_Pol@nl.compuware.com
------------------------------
Date: 28 May 1997 06:46:49 GMT
From: morpheus@calweb.com (Steve Lamb)
Subject: Re: any editor for perl?
Message-Id: <slrn5onl6r.1bh.morpheus@web1.calweb.com>
biceps@hkstar.com in <<338AF477.FE11738D@hkstar.com>> wrote:
>I found that those .pl files edited under Win95/Dos Editor will not work
>properly.
>But if I edit them in the unix shell with pico, they works fine.
>is out there any editor which workable with perl under Win95/Dos
>Environment?
Take a look at JED. It has context highlighting for perl and has
versions for Win95/NT, Win31, DOS, OS/2, Linux, FreeBSD which covers the OSs
that I use on a day to day basis. :)
--
Steve C. Lamb | Opinions expressed by me are not my
http://www.calweb.com/~morpheus | employer's. They hired me for my
| skills and labor, not my opinions!
---------------------------------------+-------------------------------------
------------------------------
Date: Wed, 28 May 1997 06:18:45 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: AWK vs Perl For Misc Data Processing Tasks
Message-Id: <EAvo79.Mx3@world.std.com>
crandall@free.click-n-call.com (Charles F. Randall) writes:
>You may find it useful to run your existing Awk code through the 'a2p'
>converter ("a2p - Awk to Perl translator") and benchmark the results
>(we'd probably be interested too).
Just be warned that the a2p translator may not convert a script into
idiomatic perl. Expect a script translated via a2p to be somewhat
slower than an equivalent script created from scratch as a perl
script.
--
Andrew Langmead
------------------------------
Date: Wed, 28 May 1997 05:13:17 GMT
From: ashton@netcom.com (Ashton)
Subject: Data::Dumper, err, DynaLoader under HPUX 9.x
Message-Id: <ashtonEAvL65.MFH@netcom.com>
Errrr, I knew that it was going too smoothly when I pulled the source,
returned thru the config, tweeked it once, and actually got the 5.004b to run.
Any knocks upside the head would be grand!
===== first, the red flag.
HP-UX mbrnet A.09.04 E 9000/817 1754083171 8-user license
===== what I was innocently trying to do
cpan> install Net::FTP
Checking for Socket...ok
Checking for IO::Socket...ok
Checking for Data::Dumper...ok
Can't find loadable object for module Data::Dumper in @INC (/usr/local/lib/perl5
/PA-RISC1.1/5.00393 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/PA-RISC1
.1 /usr/local/lib/perl5/site_perl .) at Configure line 8
BEGIN failed--compilation aborted at Configure line 8.
===== The gory version
Can't find loadable object for module Data::Dumper in @INC (/usr/local/l
ib/perl5/PA-RISC1.1/5.00393 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/
PA-RISC1.1 /usr/local/lib/perl5/site_perl .) at ./w line 12
Carp::croak('Can\'t find loadable object for module Data::Dumper in @INC
(/us...') called at /usr/local/lib/perl5/PA-RISC1.1/5.00393/DynaLoader.pm line
132
DynaLoader::bootstrap('Data::Dumper') called at /usr/local/lib/perl5/sit
e_perl/Data/Dumper.pm line 26
require Data/Dumper.pm called at ./w line 12
main::BEGIN() called at /usr/local/lib/perl5/PA-RISC1.1/5.00393/DynaLoad
er.pm line 0
eval {...} called at /usr/local/lib/perl5/PA-RISC1.1/5.00393/DynaLoader.
pm line 0
main::BEGIN() called at /usr/local/lib/perl5/site_perl/Data/Dumper.pm li
ne 0
eval {...} called at /usr/local/lib/perl5/site_perl/Data/Dumper.pm line
0
BEGIN failed--compilation aborted at ./w line 12.
=====
These don't want to compile
dynamic_ext='Fcntl IO NDBM_File ODBM_File Opcode POSIX SDBM_File Socket'
(If they are even the same creatures as above)
Making Fcntl (dynamic)
Running Mkbootstrap for Fcntl ()
chmod 644 Fcntl.bs
LD_RUN_PATH="" ld -o ../../lib/auto/Fcntl/Fcntl.none -b -L/usr/local/li
b Fcntl.o
ld: DP-Relative Code in file Fcntl.o - Shared Library must be Position-Independe
nt
*** Error code 1
=====
Summary of my perl5 (5.0 patchlevel 3 subversion 93) configuration:
Platform:
sname=hpux, osvers=9, archname=PA-RISC1.1
uname='hp-ux mbrnet a.09.04 e 9000817 1754083171 8-user license '
hint=previous, useposix=true, d_sigaction=define
bincompat3=n useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.6.0 snapshot 940827
cppflags='-I/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.6.0/include -mpa-risc-1
-1'
ccflags ='-I/usr/local/lib/gcc-lib/hppa1.1-hp-hpux/2.6.0/include -mpa-risc-1
-1'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=undef, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=n, randbits=15
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib'
libpth=/lib /usr/lib /usr/local/lib
libs=-lndbm -ldld -lm -lc
libc=/lib/libc.sl, so=sl
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'
=====
------------------------------
Date: Tue, 27 May 1997 22:21:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: extract character from string array and use as integer
Message-Id: <3c8gm5.lg8.ln@localhost>
David Dougal (ddougal@concentric.net) 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?
$one = substr($array[0], 2, 1); # get the third char from the first element
$two = $one + 1; # use it as an integer
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Wed, 28 May 1997 02:00:41 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: extracting columns
Message-Id: <tcyangEAvC95.K9v@netcom.com>
(untested)
You use the structure
@foo = split(/\s/, $_);
to decompose a line into an array, then $foo[i] will be the (i+1)th
column you are looking for.
If you are handling data from the other people, perhaps you need to
check whether i exceeds the index range of @foo or not.
======================================
Vijay Telang (vijay.telang@citicorp.com) wrote:
: Hi all
: Can someone give me some idea about how to cut/change a column from a
: ascii file. I extarct an ASCII file from one of my systems and need to
: change dat in specific columns, such as a date field etc.
: In shell script I would be using cut to do the job. SO what would be
: equevelent to cut.
--
Tung-chiang Yang tcyang@netcom.com
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: 28 May 1997 01:05:14 -0500
From: scribble@shoga.wwa.com (Tushar Samant)
Subject: Re: extracting columns
Message-Id: <5mghuq$4ks@shoga.wwa.com>
In article <tcyangEAvC95.K9v@netcom.com>,
Tung-chiang Yang <tcyang@netcom.com> wrote:
> @foo = split(/\s/, $_);
>
>to decompose a line into an array, then $foo[i] will be the (i+1)th
>column you are looking for.
It's much more likely that "cut -c" type behaviour was desired.
In that case you need @foo = unpack($t, $_); where $t could be
something like "A2A3A4" ...
So: look up pack and unpack in the perlfunc man page.
>======================================
>Vijay Telang (vijay.telang@citicorp.com) wrote:
>: Hi all
>
>: Can someone give me some idea about how to cut/change a column from a
>: ascii file. I extarct an ASCII file from one of my systems and need to
>: change dat in specific columns, such as a date field etc.
>
>: In shell script I would be using cut to do the job. SO what would be
>: equevelent to cut.
------------------------------
Date: 28 May 97 06:10:17 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: extracting columns
Message-Id: <01bc6b2d$d609d440$e20f10c2@odens.di.vhojd.skovde.se>
Vijay Telang <vijay.telang@citicorp.com> wrote
> Can someone give me some idea about how to cut/change a column from a
> ascii file. I extarct an ASCII file from one of my systems and need to
> change dat in specific columns, such as a date field etc.
Hi. You could use the substr() function.
E g substr($Buf, 19, 10) will get ten characters starting at character
position
20 (first char is number 0).
substr($Buf, 15) will get all characters from the 16th to the end of the
string.
substr($Buf, -10) will count 10 characters from the end and return them. I
e negative
offset starts from the end of the string.
Check out man perlfunc for more information about substr().
Hope this helps
/Fredrik
------------------------------
Date: Wed, 28 May 1997 12:21:20 +1000
From: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: Help with delimited fields...
Message-Id: <338B96A0.292B@comdyn.com.au>
Paul W. Campbell wrote:
> As you'll note, I want only fields 9 & 8 (respectively) and it will
> alwways be delimited by a "|". What is the best was to do this?
*A* way:
my $string = 'login|98-P49344W|CFI_FB3.0|1.1|96/10/02
04:08:23||96/10/0215:29:46|sgc/bin/login|1.1|96/10/02
04:08:23||sgc/bin/login||0644||||||||||||||||||||';
my ($a, $b) = (split(/\|/, $string))[7,8];
print "$b : $a\n";
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Wed, 28 May 1997 06:38:38 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: I'm having problems with my "here document" syntax
Message-Id: <EAvp4E.469@world.std.com>
Jean-Paul Cozzatti <jp@dkstat.com> writes:
>I'm using the following code: copied from Gundavaram...CGI Programming
>print <<End_Of_HTML
>Content-type: text/html
>..
>..
>..
>End_Of_HTML
>but I'm getting an error message that says:
>Can't find string terminator "End_Of_HTML" anywhere before EOF at
>filename...
1. Make sure that there is no space between "End_Of_HTML" and the
newline.
2. Make sure that if you copied the file between different operating
systems, you copied it in ASCII mode. (If a Unix perl interpreter sees
"End_Of_HTML\r\n", it will see whitespace after the string
End_Of_HTML)
--
Andrew Langmead
------------------------------
Date: Tue, 27 May 1997 21:23:19 -0400
From: Bill Cowan <billc@tibinc.com>
To: Richard <RJOWork@postoffice.worldnet.att.net>
Subject: Re: Is it possible to access Microsoft SQL databases with perl?
Message-Id: <338B8907.46D9@tibinc.com>
Richard wrote:
>
> Hello,
>
> I am trying to find a way to access a Microsoft SQL database using
> perl, can this be done?
If you are using Win32 Perl (ActiveWare port) on NT or Win95, then you
can use an ODBC module listed below. From Unix, I am not aware of an
ODBC module to connect to MS SQL Server. You should also check out:
http://www.hermetica.com/technologia/DBI/
for DBD/DBI info.
Useful URLs for Win32 Perl (NT Perl)
------------------------------------
Win32 Perl for Windows NT:
http://www.activeware.com/ [also online web pages]
http://www.perl.com/CPAN/ports/win32/Perl5/
Database access via ODBC by Dave Roth's Win32::ODBC module:
Win32::ODBC Home Page with Online Documentation:
http://www.roth.net/odbc/
Also see FAQ for database questions.
Download from:
http://www.perl.com/CPAN/authors/Dave_Roth/
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: Wed, 28 May 1997 14:34:29 +0800
From: Benny Chee <chchee@iti.gov.sg>
Subject: listing of Filenames under a directory
Message-Id: <Pine.SOL.3.91.970528143210.2751A-100000@hercules.iti.gov.sg>
Hi,
Just wondering if there are any modules
that list the all the filenames in a
directory?
for example in /etc :
it will list i)sendmail.cf.auto
ii)lynx.cf
ii)yadda yadda,etc
Benny Chee :) | "I used to have a life,
chchee@iti.gov.sg | but now I have a modem."
------------------------------
Date: Tue, 27 May 1997 21:20:24 -0700
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: LWP and SIG traps not playing well together!
Message-Id: <338BB288.1257@ixlabs.com>
Hi.
Posted this earlier, we have narrowed down the problem to this:
When we catch 'die' sigs, LWP gives us a warning, here's the nice and
tight test script - try it before and after commenting out the $SIG trap
line:
#!/usr/local/bin/perl5 -Tw
_trap_die ('eek!');
sub _trap_die {
my $msg = shift;
print $msg;
}
use LWP::UserAgent;
use strict;
$SIG{'__DIE__'} = \&_trap_die;
my $ua = new LWP::UserAgent;
#PS Please reply via direct email if you respond from the list as I am
#not subscribed - thank you.
------------------------------
Date: 28 May 1997 00:56:23 -0500
From: scribble@shoga.wwa.com (Tushar Samant)
Subject: Re: Magical Auto-increment operator
Message-Id: <5mghe7$393@shoga.wwa.com>
In article <338B2BFF.3CDA@electriciti.com>,
Rob Perelman <robp@electriciti.com> wrote:
>I am a little confused by Perl's handling of the magical auto-increment
>operator. In the second edition of the Camel, it is explained on page
>79 that the variable must match the pattern /^[a-zA-Z]*[0-9]*$/ for it
>to be interpreted as a string. Why is this?
^^^^^^^^^^^
This is misleading; it's specifying when magic increments
work. It's a matter of having a simple set of rules.
[a-zA-Z]*[0-9]* words are manifestly not numbers when they
contain non-numerics.
1.1 and 1e1, on the other hand, ARE numbers. You like to
increment them to 1.2 and 1e2; I think that's absurd. Perl's
answers (2.1 and 11) are far better.
How will you extend the behaviour even to \w*? What does "9z"
increment to? You say "00a"--well, why? That's not intuitive
to me. If you say "10a", it's as intuitive as "9aa". Magic
should be far more boring and humdrum, it should be almost
nauseatingly predictable.
The point is: one would use automagical increment to do some-
thing like...maybe make up filenames for a "csplit" kind of
utility. It's enough to stay within "ab12" type strings. If
I did want to increase my domain, I might split on (\W+), do
something obvious to the segments and join them up again. Or
do something else.
------------------------------
Date: Tue, 27 May 1997 14:52:23 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: newbie - perl modules
Message-Id: <b.wilkinson-2705971452230001@ip57-york.pindar.co.uk>
In article <33862DDC.4BB@cs.berkeley.edu>, cathyh@cs.berkeley.edu wrote:
> How do you install a perl module? Any webpages about this?
>
> Thanks,
> Cathy
>
> Please email
> cathyh@cs.berkeley.edu
Hello,
1. Get the module (generally from a CPAN site). It will probably be
supplied as a .tar.gz file.
2. Unzip and untar this file (GNU tar works best for this - it
can be done with "tar zxvf file.tar.gz").
3. Read the README, and follow the instructions.
These are generally "perl Makefile.PL ; make ; make check ; make install"
Bob
--
I have become death, destroyer of the worlds.
------------------------------
Date: 28 May 1997 06:25:53 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Re: OS/2: Locales / I18N problem: What to do?
Message-Id: <5mgj5h$5fs@news.nl.compuware.com>
>
>I wonder why the binary installer did not put the corresponding
>variable (PERL_BADLANG) into your config.sys... Did you mangle the
>results of the installation, or did you change your LANG after you
>installed perl?
>
>Ilya
>
Thanks Ilya for yet another response! You seem to be the only guy around
with interest in Perl/2. Well, with me you have at least 1 very happy customer!
The installer did indeed add PERL_BADLANG. As I couldn't repair the I18N issues,
I set PERL_BADLANG=0 to get rid off the messages.
Btw, I didn't mangle anything. My installation is a fresh one. Nevertheless,
maybe I should re-install to double check the installer queries and my responses.
Koos Pol
----------------------------------------------------------------------
S.C. Pol
PC Systems Administrator
Compuware Europe B.V.
email: Koos_Pol@nl.compuware.com
------------------------------
Date: Thu, 22 May 1997 08:51:27 -0800
From: " mickeyc"@amgen.com
Subject: Perl 5 CGI on Win95, How?
Message-Id: <33847908.16CC@amgen.com>
I've installed Perl5, Website on my Windows95 PC. Now I want to
port some of my Perl CGI Code from Unix to Windows. Can anybody
tell me how to do it?
Thanks in advance!
MC
*** Disclaimer: These are the opinions of the poster not Amgen Inc.***
------------------------------
Date: Wed, 28 May 1997 14:49:35 +1000
From: Sacha Fernandez <sage@ans.com.au>
Subject: perl newbie stuck!!
Message-Id: <338BB95C.335A609D@ans.com.au>
Excuse me for potentially asking such a simple question.
I have found a simple perl program on the web which allows a user to
jump to a page within a site or other jump to other sites. That works
fine on simple page with no frames but when I implement a form which
utilises the script in frames I'm not quite sure how to direct the jump
to pages into the main body of the page. Do I have to put something into
the cgi script our do I have to insert a base target line my html file.
I would be extremely pleased if anyone could offer me help.
------------------------------
Date: Wed, 28 May 1997 06:28:53 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Problem with <>
Message-Id: <EAvoo5.210@world.std.com>
Bruce Bromberek <bromberek@cems.umn.edu> writes:
>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.
In Unix, globbing is done by the shell, before the program
starts. When you say "myprogram *.dat", the shell converts the "*.dat"
to a list off all the files that end in ".dat" and pass each filename
as a separate command line argument.
So when you say "myprogram *.dat", $ARGV[0] contains the first file,
$ARGV[1] contans the second, etc. When you do a fileglob on the first
file name (contained in $ARGV[0],) you will get only the first
filename.
If you say:
while($filename = shift @ARGV)
(or "while(defined $filename = shift @ARGV)" which won't prematurely
exit if a file is named "0")
or
foreach $filename(@ARGV)
then most likely, you will iterate over all of the .dat files that the
shell has passed to you.
--
Andrew Langmead
------------------------------
Date: Wed, 28 May 1997 02:30:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules. PERL!
Message-Id: <EAvDMK.BtA@nonexistent.com>
On 27 May 1997 10:30:45 GMT, Alexander Petrosyan (paf@fbit.msk.su) wrote in
comp.lang.perl.misc,comp.lang.perl.modules
<URL: news:01bc69cf$8ab9a420$32c8c8c8@paf>:
++ 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.
++
++ Wanna write count.pl, which outputs "content-type: image/gif".
++ For now, I only found
++ http://www.eecs.ukans.edu/~skang/programs/ksl-count.txt counter which
++ outputs image/x-xbitmap.
++
++ That's good in that aspect, that it's kind I'm looking for - PURE PERL.
++ But I want multicolored image, which is impossible with x-xitmap content
++ type.
Output a PPM format then.
++ It is POSSIBLE to convert GIFLib for example into Perl but, I'm sure,
++ somewhere there ALREADY ARE such a thing.
I don't understand what's against using existing (C) modules.
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: Tue, 27 May 1997 19:55:14 +0000
From: brennan@byte-back.com
Subject: Random number problem
Message-Id: <338B3C22.C1C@byte-back.com>
I am trying to get to create a perl that will randomly select a page and
display it. Pretty simple. I have tested on my local machine and it
works great. On the Apache linux server that the site is on I
continuely get number 9. here is the script.
#!/usr/local/bin/perl
print "Pragma: no-cache", "\n";
print "Content-type: text/html", "\n\n";
$random = int (rand (78));
$random_card = $random;
print "Location: /cards/", $random_card, "card.html", "\n\n";
exit (0);
I have 78 pages I want it to pick from. I can't figure out what is
going on. I have tested it from 5 machines that all return with 9.
Help please.
Brennan
------------------------------
Date: Wed, 28 May 1997 03:07:28 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Random number problem
Message-Id: <tcyangEAvFCG.1D1@netcom.com>
Make sure you choose a good random seed with "srand" on page 223 of the
Camel book, which also suggest a good random seed.
============================
brennan@byte-back.com wrote:
: I am trying to get to create a perl that will randomly select a page and
: display it. Pretty simple. I have tested on my local machine and it
: works great. On the Apache linux server that the site is on I
: continuely get number 9. here is the script.
: #!/usr/local/bin/perl
: print "Pragma: no-cache", "\n";
: print "Content-type: text/html", "\n\n";
: $random = int (rand (78));
: $random_card = $random;
: print "Location: /cards/", $random_card, "card.html", "\n\n";
: exit (0);
: I have 78 pages I want it to pick from. I can't figure out what is
: going on. I have tested it from 5 machines that all return with 9.
: Help please.
--
Tung-chiang Yang tcyang@netcom.com
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Tue, 27 May 1997 14:13:44 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: RCS-style version mgmt implementation in Perl?
Message-Id: <b.wilkinson-2705971413440001@ip57-york.pindar.co.uk>
In article <vlb-ya023580002105971513030001@news2.apple.com>, vlb@apple.com
(Vicki Brown) wrote:
> I would love to find a simple Revision Control System, ala RCS, to use on a
> Macintosh. It doesn't have to have a fancy GUI and I really don't want a
> high overhead
> "design your project, multiple variants, multiple users" interface. I want
> (essentially) RCS: checkin and checkout. diff and merge if/when I need
> them. A log, deltas, checkin comments. Adherence to the KISS principle.
>
> A version of RCS re-implemented in Perl would probably be just fine;
> I'll port it to MacPerl and off I'll go.
> I haven't (yet) been able to find what I'm looking for.
>
> Does anyone know of a Perl implementation of RCS? (Or something akin to RCS?)
> I really don't have time to write this myself :-(
>
> Please respond by Email (vlb@apple.com); I don't read NetNews often. If I
> get anything that seems worth sharing I'll post back a summary.
>
> Thanks -
>
> Vicki
>
> --
> -------------
> Vicki Brown - vlb@apple.com, www.mklinux.apple.com - Apple Computer
> MkLinux advocate, Rhapsodist, Stagehand, Utility repair tech, Web Gardener
Hello,
There is an implementation to work under Pete Keleher's Alpha editor at
ftp://www.cs.umd.edu/pub/faculty/keleher/Alpha/contrib/RCS.sit.hqx.
Bob
--
I have become death, destroyer of the worlds.
------------------------------
Date: Wed, 28 May 1997 01:04:32 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: RegExp tutorial suggestions?
Message-Id: <338b83e0.9264309@news.wwa.com>
On Thu, 22 May 1997 20:51:05 -0400, "Jason A. Soloff"
<jsoloff@psu.edu> wrote:
>Does anyone know of a good regexp tutorial or FAQ online?
>Doesn't have to be incredibly perl heavy, just explain how to
>set up and use the regexps...
It's not on-line, but the _Perl Journal_ has a column dedicated to
mastering regular expressions which might be easier to swallow than
the O'Reilly book. Yet, I image you will eventually want to purchase
the O'Reilly book after getting started with the columns from the Perl
Journal.
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
------------------------------
Date: Mon, 26 May 1997 12:05:52 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: rounding floats /mlml
Message-Id: <gtfcm5.igc.ln@localhost>
Michel Lee (ae299@FreeNet.Carleton.CA) wrote:
: I'd like to know how to round a float in perl.
^^^^^
^^^^^
: I've looked everywhere but cannot find the answer, pls help.
^^^^^^^^^^
It appears that everywhere does not include the Perl FAQs...
part 4 has this question:
"Does perl have a round function? ..."
^^^^^
^^^^^
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 28 May 1997 03:00:34 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: using getopt or getopts function
Message-Id: <5mg74i$cho@fridge-nf0.shore.net>
SPrashant (sprashant@aol.com) wrote:
: I am a new user of perl and I am trying to use the library module getopt
: in my script. I get "Bus error(core dumped)". Following script is a test
: script that produces the above error.
What OS are you using? What version of Perl?
: #! /usr/local/bin/perl
What's this?
#!/usr/local/bin/perl -w
: use Getopt::Std;
: getopt('dV');
Looks ok to me.
What else are you using in your script?
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 27 May 1997 23:04:59 -0700
From: marks@halcyon.com (Peter Marks)
Subject: Who am I? (I'm a perl script)
Message-Id: <5mghub$6sm$1@halcyon.com>
If a perl script needs to know its containing directory (e.g., to
find related files) without hardcoding it in, a common trick is
to strip the filename off $0. On my current system (an NCR
processor running SVR4 and perl 5.003), this fails when the
script is suid or sgid to something other than the user's current
settings. In that case $0 takes a value like "/dev/fd/3".
Is this the proper behavior? If so, how should the script find
out where it is?
--
P-)
___o - o Peter Marks <marks@halcyon.com>
_-\_<, - _\ /\_ 15307 NE 202nd Street (425)489-0501
(*)/ (*) - (*)^(*) Woodinville, WA 98072
-----------------------------
More comfortable AND faster ... that's REAL technology!
------------------------------
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 530
*************************************