[8136] in Perl-Users-Digest
Perl-Users Digest, Issue: 1754 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 28 19:07:35 1998
Date: Wed, 28 Jan 98 16:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 28 Jan 1998 Volume: 8 Number: 1754
Today's topics:
Re: -dates in perl- (I R A Aggie)
Re: @ == @, comparing arrays (Charles DeRykus)
Re: [silliness] Camel and llama successfully cross-bred (Nathan V. Patwardhan)
Re: Anyway to handle inconsistent perl locations in #! <tchrist@mox.perl.com>
Re: Anyway to handle inconsistent perl locations in #! <rpsavage@ozemail.com.au>
Re: Check Variable type <ajohnson@gpu.srv.ualberta.ca>
Re: Check Variable type <danboo@negia.net>
Re: Efficiently break a string of [a..z]+ into words us <Perry.G.Ramsey@lmco.com>
Re: Find ^M in file <tchrist@mox.perl.com>
Re: Find ^M in file (brian d foy)
function call problem is solved - solution is here <bhanu@usl.edu>
Help with SORT <downin@smarty.smart.net>
Re: Help with SORT (brian d foy)
Re: Help with SORT <dgwilson@gte.net>
Re: Help with SORT <dgwilson@gte.net>
Re: Newbie Question (Perl on NT 4.0 and IIS 3.0). <peterson@cns.uni.edu>
Perl CGI real-time database application Sarah.Kamal@cgy.valmet.com
perl on line documentation? (Michael Wang)
Re: perl on line documentation? (brian d foy)
Perl output into html frame? <orangutan@grungyape.com>
Re: Perl output into html frame? (brian d foy)
PERL5x4x4 fails on 'make' <george@esa.nascom.nasa.gov>
Re: Profiler for Perl4 (yup. Perl4) (Jeff Stampes)
Re: READ THIS FIRST (O'Shaughnessy Evans)
Re: regexes: fun with /x <*@qz.to>
Regular expression help.... <sviper@inav.net>
Re: Regular expression help.... <kmiles@erols.com>
Re: replacement for ls command? (Jeff Stampes)
Re: replacement for ls command? (Michael Wang)
Re: replacement for ls command? (brian d foy)
Some Questions Regarding Error Messages Generated by th <vchandra@mail.delcoelect.com>
Re: Some very basic perl ?'s (brian d foy)
Re: Some very basic perl ?'s <orangutan@grungyape.com>
Re: Survival Of perl <jsd@hudsucker.gamespot.com>
the m and s modifiers in //m and //s (Michael Wang)
Re: the m and s modifiers in //m and //s (brian d foy)
under what shell system(...) runs the unix command? (Michael Wang)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jan 1998 17:07:41 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: -dates in perl-
Message-Id: <fl_aggie-2801981707410001@aggie.coaps.fsu.edu>
In article <8nwcuGAeO2z0EwU5@cydaps.co.uk>, James <James@cydaps.co.uk> wrote:
+ I can mange to do this for todays date, but how would I do it from a
+ variable containing a date in seconds, ie 886008059 (which would become
+ the 28/01/98)?
$local_date=localtime(886008059);
print "$local_date\n";
Wed Jan 28 12:20:59 1998
Obviously, you'll have to tweak to make it do what you want, but that's
the general idea. If you want, you could substitute gmtime() in for
localtime().
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Wed, 28 Jan 1998 20:23:56 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: @ == @, comparing arrays
Message-Id: <EnIGnx.FAB@bcstec.ca.boeing.com>
Keywords: hornwort magma pandemic wristband
In article <6aiu6f$cr9$1@cyprus.atlantic.net>,
Chip Salzenberg <chip@pobox.com> wrote:
> According to ced@bcstec.ca.boeing.com (Charles DeRykus):
>>For crying out loud, I didn't say "universal, gospel, scientific
>>truth." I said "works well". In most engineering realms that's
>>adequate.
>
> Software isn't wiring. In the programming dictionary, the entry
> for "almost right" reads "see 'wrong'".
I agree totally. But, my original premise was "...a less
comprehensive test might have some redeeming social value."
Sometimes, just exploring what's possible can be fun,
and a non-universally accurate test can occasionally be
useful - even in Software.
On a personal note, I can't recall a more patronizing,
transparently arrogant, oppressive response than the
one triggering the "For crying out loud..." continuation.
Responses like that are unusual in the Perl newsgroups.
I hope it remains a rarity.
--
Charles DeRykus
------------------------------
Date: 28 Jan 1998 22:08:10 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: [silliness] Camel and llama successfully cross-bred!
Message-Id: <6aoa8a$hga@fridge.shore.net>
Brian Altheim (altheim@agc.bio.ns.ca) wrote:
: It's true! See for yourself! I hate to contemplate what this
: means for O'Reilly's perl books in the future.
They'll either be longer or missing pages, or someone will morph the
language into 'Erl' that won't be distributed with any documentation
because no one reads it, anyways. :-)
--
Nathan V. Patwardhan
please don't send spam to president@whitehouse.gov
------------------------------
Date: 28 Jan 1998 22:04:20 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Anyway to handle inconsistent perl locations in #! ?
Message-Id: <6aoa14$oel$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, carroll@tjc.com (Terry Carroll) writes:
:I have some perl programs that are resident on a filesystem mounted on two
:different systems.
The bilingual eval-exec trick in perlrun(1) is suggested:
#!/bin/sh -- # perl
eval 'exec perl -S -w $0 ${1+"$@"}'
if $running_under_some_shell;
That (or variations thereof) will work in most places. This assumes that
"perl" is in the current path at some point.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Sometimes I wish I could put an expiration date on my quotes." --Larry Wall
------------------------------
Date: Thu, 29 Jan 1998 09:26:20 +1000
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Anyway to handle inconsistent perl locations in #! ?
Message-Id: <34CFBE9C.43CB@ozemail.com.au>
Terry Carroll wrote:
>
> I have some perl programs that are resident on a filesystem mounted on two
> different systems.
> [snip]
Try:
#!/bin/csh -f
#
# Name:
# configure.
#
# Note:
# We start life as a csh script, and then become a Perl script.
#
# Note:
# Tab == 4 spaces or die.
set perl = `which perl`
set perlflags = ""
setenv PLATFORM sgi
setenv PERL $perl
setenv PERL5LIB perl/scripts/lib
eval "$perl $perlflags -x $0 -platform $PLATFORM $*"
exit
#!perl -w
#
# Name:
# configure.pl.
#
use integer;
use strict;
# Process command line options like -platform.
# Other rubbish...
exit(0);
--
Cheers,
Ron Savage
Office: savage.ron.rs@bhp.com.au
Home (preferred): rpsavage@ozemail.com.au
------------------------------
Date: Wed, 28 Jan 1998 16:27:48 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Check Variable type
Message-Id: <34CFB0E4.F0E708A@gpu.srv.ualberta.ca>
Jeff Stampes wrote:
!
[snip]
! Ouch...Yup, that'll work, but as we all know, TMTOWTDI:
!
! print "How many beers do you want? ";
! my $input = <STDIN>;
! chomp $input;
! ($input =~ m{\D}) ?
! print "Not a number!\n" :
! print "$input beers, coming right up!\n";
!
! If it matches a non-digit, it's not an integer
!
so you won't sell me 1e2 beer even if I promise not
to drive?
:-)
andrew
------------------------------
Date: Wed, 28 Jan 1998 18:35:02 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Check Variable type
Message-Id: <34CFC0A6.D347656E@negia.net>
Jeff Stampes wrote:
>
> Real (real@earthling.net) wrote:
> : Daniel Balderman <Daniel.Balderman@digital.com> wrote in article
> : <34CC7D84.5B4@digital.com>...
> : > I'm writing a WEB application where the user has to enter an integer.
> : > How can I check the user input to see if the user has entered the
> : > correct type (in this case integer).
>
> : This is a Unix style of checking. There might be a shorter one but this
> : will work.
>
> : print "Number: "; $number = <STDIN>; chomp($number);
> : $chknum = $number; $chknum =~ s/[0-9]//g;
> : if ($chknum eq '') { print "Nummeric\n" } else { print "Alpha-nummeric\n";
> : }
>
> Ouch...Yup, that'll work, but as we all know, TMTOWTDI:
>
> print "How many beers do you want? ";
> my $input = <STDIN>;
> chomp $input;
> ($input =~ m{\D}) ?
> print "Not a number!\n" :
> print "$input beers, coming right up!\n";
>
> If it matches a non-digit, it's not an integer
unless there is a minus sign (or even a plus). don't forget your
friend and mine the negative integer. your test is appropriate for
whole numbers i believe. your test may be exactly what the original
poster wanted, but is not what was specified. as always though, it
depends on what you know and expect from your data.
dan boorstein
------------------------------
Date: Wed, 28 Jan 1998 14:32:41 -0700
From: "Perry G. Ramsey" <Perry.G.Ramsey@lmco.com>
Subject: Re: Efficiently break a string of [a..z]+ into words using dictionary
Message-Id: <34CFA3F9.F94A1249@lmco.com>
Zachary Brown wrote:
>
> For a random text generation program I'm working on (actually a set of
> programs whose tasks are to feed potential text to each other---it's
> weird), I've been trying to time-optimize the following recursive
> subroutine (which is heavily used by the program), whose task is to take a
> string of letters such as "itryeat" and break it into all possible word
> sequences (if its possible at all), using a dictionary stored as a
In the pink camel there is a password checking program that
does just this sort of thing. It even claims to be able to
make distinctions between
CaMelate OK. Strange capitalization of a non-word
camelate Not OK. Various combinations of real words.
CameLate
CamElate
CamelAte
I don't know where you'll find a pink camel these days, and
the program isn't in the blue camel. If you can't locate one
locally, let me know and I can send you the relevant pages.
--
Perry G. Ramsey
Perry.G.Ramsey@lmco.com
------------------------------
Date: 28 Jan 1998 22:35:28 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Find ^M in file
Message-Id: <6aobrg$se9$1@csnews.cs.colorado.edu>
Keywords: from just another new york perl hacker
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, comdog@computerdog.com (brian d foy) writes:
: $data =~ s/ \c M //xg;
That doesn't work.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Hey, I had to let awk be better at *something*... :-)
--Larry Wall in <1991Nov7.200504.25280@netlabs.com>1
------------------------------
Date: Wed, 28 Jan 1998 18:17:45 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Find ^M in file
Message-Id: <comdog-ya02408000R2801981817450001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6aobrg$se9$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com (Tom Christiansen) posted:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, comdog@computerdog.com (brian d foy) writes:
>: $data =~ s/ \c M //xg;
>
>That doesn't work.
oops, spurious space:
$data =~ s/ \cM //xg;
sorry about that...
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 17:04:57 -0600
From: "Bhanu P. Suravarapu" <bhanu@usl.edu>
Subject: function call problem is solved - solution is here
Message-Id: <34CFB999.167EB0E7@usl.edu>
Hi,
Thanks for your time and effort. One of the guys (Guy Decoux) from the
news group solved the
problem. Probably your solution would have also worked, since the
problem is
with the open statement.
I had something like
$var = <filename>
open(FILE,$var);
The problem was in the first line, it should have been "filename".
Thank you,
bhanu.
------------------------------
Date: 28 Jan 1998 21:52:49 GMT
From: Dave Downin <downin@smarty.smart.net>
Subject: Help with SORT
Message-Id: <6ao9bh$i6p$1@news.smart.net>
Help! I'm trying to sort a list into sort of an index fashion. I have the
following code which doesn't do the full job:
#!/usr/bin/perl
@list = (0,1,1.1,1.10,1.2,2.1);
@newlist = sort { $a <=> $b } @list;
foreach $value (@newlist) {
print "$value\n";
}
So I get:
0
1
1.1
1.1
1.2
2.1
What I want is:
0
1
1.1
1.2
1.10
2.1
--
Dave Downin (dave@arlo.net)
=============================================================================
"And the faces of the comrades, Being blown out of the sky, Leaves you bitter
with the feeling, That they didn't have to die" - Arlo Guthrie
ArloNet - http://www.arlo.net/
=============================================================================
------------------------------
Date: Wed, 28 Jan 1998 17:29:34 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help with SORT
Message-Id: <comdog-ya02408000R2801981729340001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6ao9bh$i6p$1@news.smart.net>, Dave Downin <downin@smarty.smart.net> posted:
>@list = (0,1,1.1,1.10,1.2,2.1);
i think you wanted those to be strings so that you don't lose
trailing zeroes. perhaps:
@list = qw( 0 1 1.1 1.10 1.2 2.1 );
>@newlist = sort { $a <=> $b } @list;
once you have strings, sort compares them as strings rather
than as numbers (although you can modify that behaviour
as you did above).
@new_list = sort @list;
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 17:58:32 -0500
From: Douglas Wilson <dgwilson@gte.net>
Subject: Re: Help with SORT
Message-Id: <6aod4j$2dn$1@gte2.gte.net>
Dave Downin wrote:
> @list = (0,1,1.1,1.10,1.2,2.1);
first to do what you want, you need to quote
each list element.
> What I want is:
> 0
> 1
> 1.1
> 1.2
> 1.10
> 2.1
I think this is what you want, it also should work for
IP address type data:
@list=qw(0 1.11 2.12 2.2 1.2 1.1 2 1.10);
@list=sort {
my @a=split(/\./,$a);
my @b=split(/\./,$b);
my $tmp;
for $idx (0..$#a) {
$tmp=$a[$idx]<=>$b[$idx] and return $tmp
}
return length(@a)<=>length(@b);
} @list;
for (@list) {
print "$_\n";
}
------------------------------
Date: Wed, 28 Jan 1998 18:12:27 -0500
From: Douglas Wilson <dgwilson@gte.net>
Subject: Re: Help with SORT
Message-Id: <6aodua$2dn$2@gte2.gte.net>
Douglas Wilson wrote:
>
Whoops!
> @list=qw(0 1.11 2.12 2.2 1.2 1.1 2 1.10);
> @list=sort {
> my @a=split(/\./,$a);
> my @b=split(/\./,$b);
> my $tmp;
> for $idx (0..$#a) {
> $tmp=$a[$idx]<=>$b[$idx] and return $tmp;
or alternatively:
return $tmp if $tmp=$a[$idx]<=>$b[$idx];
> }
> return length(@a)<=>length(@b);
Oops I mean:
return $#a<=>$#b;
> } @list;
> for (@list) {
> print "$_\n";
> }
------------------------------
Date: Wed, 28 Jan 1998 16:51:51 -0600
From: Kerry Peterson <peterson@cns.uni.edu>
To: freen@dds.nl
Subject: Re: Newbie Question (Perl on NT 4.0 and IIS 3.0).
Message-Id: <34CFB687.B86ABF72@cns.uni.edu>
You need to install Active Server Pages for IIS 3.0 available for
download somewhere on the MicroCrap website. At the site, you have to
select download IIS 3.0 and then select only the ASP option.
>
------------------------------
Date: Wed, 28 Jan 1998 17:02:23 -0600
From: Sarah.Kamal@cgy.valmet.com
Subject: Perl CGI real-time database application
Message-Id: <886028210.399179788@dejanews.com>
I'm not sure if the application that I need to create is even possible.
The application has to display data from a UNIX server on a PC. I was
thinking that I would write a perl cgi script for this and display with
an html page of tables. The real problem is that the data on the page
has to update continuously while the page is open and I'm not sure how a
cgi script can run continuously.
Thanks for the help.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 28 Jan 1998 22:02:13 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: perl on line documentation?
Message-Id: <6ao9t5$lnu$1@news.ml.com>
Does perl has on line documentation? For example, if I
want to find the syntax for truncate, seek, split? Thanks.
------------------------------
Date: Wed, 28 Jan 1998 18:32:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: perl on line documentation?
Message-Id: <comdog-ya02408000R2801981832020001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6ao9t5$lnu$1@news.ml.com>, mwang@alhena.ibk.ml.com (Michael Wang) posted:
>Does perl has on line documentation? For example, if I
>want to find the syntax for truncate, seek, split? Thanks.
perldoc perlfunc
it comes with perl. however, you can also find it somewhere
on CPAN.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 16:58:53 -0500
From: "Franklin L. Petersen" <orangutan@grungyape.com>
Subject: Perl output into html frame?
Message-Id: <6ao9kc$354$1@cletus.bright.net>
I'd like to have my form submission return its perl values to a different
html frame then the form itself.
I have a 3 frame page, assume the bottom has the form, and I want it to
output to the top frame.
Now, is my first problem because I have my frame setup in html and not perl?
Or is there a command to direct perl's output?
Thanks, please e-Mail,
Frank
orangutan@grungyape.com
------------------------------
Date: Wed, 28 Jan 1998 17:24:06 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl output into html frame?
Message-Id: <comdog-ya02408000R2801981724060001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6ao9kc$354$1@cletus.bright.net>, "Franklin L. Petersen" <orangutan@grungyape.com> posted:
>I'd like to have my form submission return its perl values to a different
>html frame then the form itself.
the references in the CGI Meta FAQ have your answer (examples even!).
other than that, CGI questions belong in
comp.infosystems.www.authoring.cgi, where the noise level is never
too high.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 18:36:27 -0500
From: G Dimitoglou <george@esa.nascom.nasa.gov>
Subject: PERL5x4x4 fails on 'make'
Message-Id: <34CFC0FB.BFB@esa.nascom.nasa.gov>
Hi!
I am trying to install Perl5004.4 on a Solaris 2.5.1 system. All goes
perfect until I run 'make'. After many succesfull lines it chokes:
`sh cflags libperl.a universal.o` universal.c
CCCMD = cc -DPERL_CORE -c
`sh cflags libperl.a globals.o` globals.c
CCCMD = cc -DPERL_CORE -c
`sh cflags libperl.a perlio.o` perlio.c
CCCMD = cc -DPERL_CORE -c
rm -f libperl.a
ar rcu libperl.a perl.o gv.o toke.o perly.o op.o regcomp.o dump.o
util.o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
doop.o doio.o regexec.o taint.o deb.o universal.o globals.o perlio.o
sh: ar: not found
*** Error code 1
make: Fatal error: Command failed for target `libperl.a'
Now I have RTFM, tried the install from scratch, reset the LD env var,
but with no luck...
Any help will be greatly appreciated! I will summarize.
George Dimitoglou
NASA Goddard Space Flight Center
------------------------------
Date: 28 Jan 1998 21:52:39 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Profiler for Perl4 (yup. Perl4)
Message-Id: <6ao9b7$hak$2@neocad.com>
Brendan Macmillan (bren@fangorn.cs.monash.edu.au) wrote:
: Ah, the ever-so-helpful responses to perl4 questions from the perl5
: community.
Is there now a perl4 and a perl5 community?
If someone asked you how to add anti-lock brakes and a fuel injection
to a Pinto, how would you respond? Maybe "Buy a modern vehicle that
was designed for those features"?
If someone wanted to view VRML pages and they were using a beta
version of Netscape 2.0, might you recommend they upgrade to
a version of Netscape that supports VRML better?
The recommendation to upgrade to perl5 should not be construed
as a slight to perl4 users nor as a tool to divide the community.
It is instead a reality of life for anyone who wishes to reap the
benefits of the community. The community supports perl5...perl4
is dead, dead, dead, and should be allowed to Rest In Peace
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: 28 Jan 1998 22:44:39 GMT
From: shaug@callamer.com (O'Shaughnessy Evans)
Subject: Re: READ THIS FIRST
Message-Id: <6aoccn$sr3$2@ha1.rdc1.occa.home.com>
In article <34CF45C5.95E@min.net>,
John Porter <jdporter@min.net> writes:
>
> Damn. As an ADA programmer, I was thinking this report might be
> useful for me. I won't send for it, because I'm afraid they would
> check up on me, to make sure I'm a card-carrying C++ programmer.
The American Dental Association doesn't like C++ programmers, eh?
Maybe Ada programmers, then?
Sorry for the non-perl post, BTW. But, really, if you wanna sound like an
Ada programmer, you've gotta know how to spell your job title :)
--
- O'Shaughnessy Evans UNIX Sys Admin, GST Call America -
- http://www.callamerica.net/shaug San Luis Obispo, California -
------------------------------
Date: 28 Jan 1998 21:58:54 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: regexes: fun with /x
Message-Id: <qz$9801281643@qz.little-neck.ny.us>
Chipmunk <rjk@coos.dartmouth.edu> wrote:
> Can you find a useful regex that will only work with the /x modifier?
*Only* work with /x? Nope, not unless you count syntax tricks. /x just
makes multiline REs easier to read. Compare:
# Be very generous about accepting "only US$15,- p min" text.
/\b(?:to|just|only) # first they try to de-emphasize it
\s+(?:[a-z]{2}\s*)? # Sometimes with something for the currency
(?:(?:\$|\#)\s*)? # Sometimes a currency notation (needs expanding)
(?:\d+[o\d]* # A number
(?:[.,](?:[o\d]{2} # with an optional fractional portion
|-)?)? # or a hyphen for 00
|\.[o\d]+) # or exclusively fractional
(?:\s*cents)? # an alternative currency location
\s*(?:\/|p(?:er|\.)?) # "per" and variations
\s*(?:m(?:in(?:ute)?)?# "minute" and variations
|h(?:ou)?r? # or "hour" '' ''
|da?y? # or "day" '' ''
|w(?:ee)k? # or "week" '' ''
|mo?n(?:th)? # or "month" '' ''
|y(?:ea)?r?) # or "year" '' ''
/ix # Ignore case and use free-format regexp
With
# Be very generous about accepting "only US$15,- p min" text.
/\b(?:to|just|only)\s+(?:[a-z]{2}\s*)?(?:(?:\$|\#)\s*)?(?:\d+[o\d]*(?:[.,](?:\
[o\d]{2}|-)?)?|\.[o\d]+)(?:\s*cents)?\s*(?:\/|p(?:er|\.)?)\s*(?:m(?:in(?:ute)\
?)?|h(?:ou)?r?|da?y?|w(?:ee)k?|mo?n(?:th)?|y(?:ea)?r?)/i
The first is far more readable any day, but both are equivilent.
Elijah
------
and some of you probably thought I meant "multiline" only when in /x mode
------------------------------
Date: Wed, 28 Jan 1998 16:18:21 -0600
From: Steel Viper <sviper@inav.net>
Subject: Regular expression help....
Message-Id: <34CFAEAD.C0CB65D4@inav.net>
All I am trying to do is find the first 10 digit number that I
come to while reading a file, and then I want to replace it with
whatever number I desire (I'm changing serial numbers across a bunch of
files). I am having difficulty coming up with a
regular expression to do this. Thank you very much in advance.
Steel Viper
------------------------------
Date: Wed, 28 Jan 1998 18:06:48 -0500
From: Kevin Miles <kmiles@erols.com>
Subject: Re: Regular expression help....
Message-Id: <34CFBA08.261D@erols.com>
Steel Viper wrote:
>
> All I am trying to do is find the first 10 digit number that I
> come to while reading a file, and then I want to replace it with
> whatever number I desire (I'm changing serial numbers across a bunch of
> files). I am having difficulty coming up with a
> regular expression to do this. Thank you very much in advance.
>
> Steel Viper
Try this:
$_ =~ s/\d{10}/WHATEVER/
or , if you might have numbers with more than 10 digits
$_ =~ s/\D+\d{10}\D+/WHATEVER/
------------------------------
Date: 28 Jan 1998 21:58:05 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: replacement for ls command?
Message-Id: <6ao9ld$hak$3@neocad.com>
Peter Chen (peter@lucent.com) wrote:
: Is there an equivalent way of doing a Unix ls command? For example,
: @found=`ls abc*/def*/some*.txt`;
Look into opendir, readdir and closedir.
HTH,
Jeff
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: 28 Jan 1998 22:00:11 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: Re: replacement for ls command?
Message-Id: <6ao9pb$lne$1@news.ml.com>
>Is there an equivalent way of doing a Unix ls command? For example,
> @found=`ls abc*/def*/some*.txt`;
>
>Without resorting to ``, or system, of course.
I do not understand this. Is perl supposed to be a super set
of C, ksh, or what? Otherwise why people constantly ask how do I
do this and that in perl as I do in unix command, ksh, etc.
ksh makes no difference between internal ksh command and external
unix command. I still do not know if the "echo" command which I
use all the time is a unix command in /usr/bin or a ksh build in
command.
------------------------------
Date: Wed, 28 Jan 1998 18:21:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: replacement for ls command?
Message-Id: <comdog-ya02408000R2801981821530001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6ao9pb$lne$1@news.ml.com>, mwang@alhena.ibk.ml.com (Michael Wang) posted:
>>Is there an equivalent way of doing a Unix ls command? For example,
>> @found=`ls abc*/def*/some*.txt`;
>>
>>Without resorting to ``, or system, of course.
>
>I do not understand this. Is perl supposed to be a super set
>of C, ksh, or what?
Perl is a mixed breed, if not a mutt.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Wed, 28 Jan 1998 17:13:48 -0500
From: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: Some Questions Regarding Error Messages Generated by the -w switch
Message-Id: <34CFAD9C.267E@mail.delcoelect.com>
1. I have been working on a Perl program for about two weeks now.
(It is about 1000 lines long - the 'main' is about 100 lines long;
the rest are all subroutines.)
2. I did not start using the -w switch. Recently, I started using
this switch. I am surprised by some of the error/warning messages
that I am getting. Obviously, I am interested in avoiding these
and would appreciate help/suggestions including pointers to books/
manpages. I have the 1992 version of the Camel book. This is my
main resource. I am aware of perlfaq1 to perlfaq9 - I should get into
the habit of spending more time with them. (By the way, do people use
these online mostly or do they print them out and use as a printed
reference ? I work on a unix system. I tried a
man perlfaq9 > file9
There are unprintable characters in the file. A couple of years
ago, I remember jumping through some hoops to print man pages
without these characters.) I am very interested in acquiring
more books and resources. I was very surprised to see about
six Perl books in our local Waldenbooks.
3. Coming back to my main focus, I am reprinting a segement of
code here. The code prints lines to a disk file. The code is
in a subroutine called writeHeaderLines.
format Line1 =
@<<<<<<<< @<<< KPH (@<<<MPH) @<<<<<<<<<<<<<<<<<<<<<<<<
$testNumber,$kmh, $mph, $testDescription
.
etc.
format Line12 =
@<<<<<<<
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<
$testNumber,
$locDescript, $comp
.
select (OUT);
$~ = Line1; write ; $~ = Line2; write ; $~ = Line3; write ; # 858
$~ = Line4; write ; $~ = Line5; write ; $~ = Line6; write ; # 859
$~ = Line7; write ; $~ = Line8; write ; $~ = Line9; write ; # 860
$~ = Line10; write ; $~ = Line11; write ; $~ = Line12; write ; # 861
4. -w gives the following errors
Possible typo: "Line12" at truckconv.pl line 848.
< Snipped >
Possible typo: "Line1" at truckconv.pl line 674.
(Lines 674 and 848 are the '.' signifying the end of the format
specifications
Line1 and Line12)
Use of uninitialized variable at truckconv.pl line 858, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 858, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 858, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 858, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 859, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 860, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 860, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 860, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 860, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 861, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 861, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 861, <TESTDATA> line
5.
Use of uninitialized variable at truckconv.pl line 861, <TESTDATA> line
5.
I do not understand why I should get this message at all. I am sure that
the variables used in Line12 are set to values before calling subroutine
writeHeaderLines.writeHeaderLines is called from a subroutine called
processTestData - this has a while (<TESTDATA>) loop. However,
writeHeaderLines
is called only after the loop. I do not understand the " <TESTDATA> line
5 "
reference.
5. The above are only a subset of the error/warning messages that I am
getting.
6. I appreciate any help. Please just point me in the right direction.
Regards.
V. Chandrasekhar
------------------------------
Date: Wed, 28 Jan 1998 17:07:47 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Some very basic perl ?'s
Message-Id: <comdog-ya02408000R2801981707470001@news.panix.com>
Keywords: from just another new york perl hacker
Please read this information on how to choose a good subject for a post:
<URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>
In article <6ao8u7$phb@bgtnsc03.worldnet.att.net>, pjmone@symbioticinc.com posted:
>I've moved on from Javascript to Perl to try to have a little cgi
>program to password protect certain areas of my web page. When I
>attempt to run the script I get an Internal Server error, and in my
>error_log it says "premature end of script headers"...Any ideas?
see the CGI Meta FAQ - especially the reference to the Idiot's Guide
to Solving Perl CGI Problems.
further CGI questions belong in comp.infosystems.www.authoring.cgi
> Also, is there anyway to use any sort of bitwise operators (AND, OR,
>XOR) in Perl?
yes. see the section on bit wise operators in the docs
perldoc perlop
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
i wondered about the sudden rise in noise until i remembered school is
back is session
------------------------------
Date: Wed, 28 Jan 1998 17:00:45 -0500
From: "Franklin L. Petersen" <orangutan@grungyape.com>
Subject: Re: Some very basic perl ?'s
Message-Id: <6ao9nq$36a$1@cletus.bright.net>
You may try running your script from the command line, ./scriptname.pl
and have it tell you the error and location...
F
Paul Mone wrote in message <6ao8u7$phb@bgtnsc03.worldnet.att.net>...
>I've moved on from Javascript to Perl to try to have a little cgi
>program to password protect certain areas of my web page. When I
>attempt to run the script I get an Internal Server error, and in my
>error_log it says "premature end of script headers"...Any ideas?
> Also, is there anyway to use any sort of bitwise operators (AND, OR,
>XOR) in Perl? thanks for your help,
> Paul
------------------------------
Date: 28 Jan 1998 23:19:49 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: Survival Of perl
Message-Id: <6aoeel$f21$1@its.hooked.net>
Chip Salzenberg <chip@mail.atlantic.net> wrote:
: Bollocks. The web is lame. The web is boring. The web is nothing
: more or less than producing formatted text on demand.
i prefer to think of it as the universal GUI. here at the office i
write tons of perl scripts to do various tasks. i could give all the
users accounts on the unix machines and let them invoke the scripts
from the command line (no doubt suffering 8 billion "what do i type if
i want it to delete all the files when it copies" calls in the
process) or i can whip up a quick front end html page and a back end
perl script and let them invoke it from their win95 browsers with
pretty drop down lists and radio buttons.
-j-
------------------------------
Date: 28 Jan 1998 21:52:07 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: the m and s modifiers in //m and //s
Message-Id: <6ao9a7$ln2$1@news.ml.com>
What is the m and s modifiers in //m and //s? The Perl
did not give more explanations than "multiple line"
and single line. Does that mean I can make a match
with /abcd/m if abc in one line and d in another? Thanks.
------------------------------
Date: Wed, 28 Jan 1998 18:31:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: the m and s modifiers in //m and //s
Message-Id: <comdog-ya02408000R2801981831130001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6ao9a7$ln2$1@news.ml.com>, mwang@alhena.ibk.ml.com (Michael Wang) posted:
>What is the m and s modifiers in //m and //s? The Perl
the s modifier allows the . meta character to match newlines (the
string is treated as a single line so that embedded newlines
are not special).
the m modifier treats the string as multiple "lines", so you
can use the anchors (^ and $) for matching parts of each "line".
>Does that mean I can make a match
>with /abcd/m if abc in one line and d in another?
no. it means that you can have do something like this:
$_ = <<"HERE";
just another
new york
perl hacker
HERE
@list = m/^(.*)/mg; #match at the beginning of each line
$" = ',';
print "@list";
__END__
just another ,new york ,perl hacker
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
m//m's definition of a line appears to be unaffected by $/
------------------------------
Date: 28 Jan 1998 21:35:26 GMT
From: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: under what shell system(...) runs the unix command?
Message-Id: <6ao8au$llg$1@news.ml.com>
under what shell system(...) runs the unix command?
ksh or sh or the shell that starts the perl? And where
it is documented? Thanks.
------------------------------
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 1754
**************************************