[23243] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5464 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 8 14:06:14 2003

Date: Mon, 8 Sep 2003 11:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 8 Sep 2003     Volume: 10 Number: 5464

Today's topics:
        "Surrogate infinity" in Perl? <jill_krugman@yahoo.com>
    Re: "Surrogate infinity" in Perl? <postmaster@castleamber.com>
    Re: "Surrogate infinity" in Perl? <postmaster@castleamber.com>
    Re: Bizarre SvTYPE after fork on W2K Server <ganchrow@nospam.com>
    Re: Call PL/SQL procedure from Perl - DBI (Sashafay)
    Re: Cautionary Note (was): AI::GA (Arthur T. Murray)
    Re: emulating @+ and @- <nospam-abuse@ilyaz.org>
    Re: exit() argument evaluation <tcurrey@no.no.no.i.said.no>
    Re: Help configuring Perl with Apache 2 <postmaster@castleamber.com>
    Re: Help configuring Perl with Apache 2 <postmaster@castleamber.com>
    Re: Help configuring Perl with Apache 2 <jwillmore@cyberia.com>
    Re: Help configuring Perl with Apache 2 <jwillmore@cyberia.com>
    Re: Newbie Q: MacPerl / CGI woes <minceme@start.no>
    Re: Newbie Q: MacPerl / CGI woes (Tad McClellan)
    Re: Newbie Q: MacPerl / CGI woes (Tad McClellan)
    Re: Problem with simple contact script. <jwillmore@cyberia.com>
    Re: simple regex problem <krahnj@acm.org>
    Re: simple regex problem <krahnj@acm.org>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 8 Sep 2003 17:22:19 +0000 (UTC)
From: J Krugman <jill_krugman@yahoo.com>
Subject: "Surrogate infinity" in Perl?
Message-Id: <bjidsb$4g6$1@reader2.panix.com>



In C, for example, one can use certain predefined constants as
"surrogate infinity", meaning that no number (of the appropriate
type) handled by a C program will ever be greater than the appropriate
constant.  For example:

int min_val;

 ...

min_val = INT_MAX; /* INT_MAX used as a surrogate infinity */
for(i = 0; i < ITER; ++i) {
  if ( min_val > arr[i] ) {
    min_val = arr[i];
  }
}

Is there a similar facility in Perl?

Thanks!

	-Jill


------------------------------

Date: Mon, 08 Sep 2003 19:25:12 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: "Surrogate infinity" in Perl?
Message-Id: <1063042017.871942@halkan.kabelfoon.nl>

J Krugman wrote:

> In C, for example, one can use certain predefined constants as
> "surrogate infinity", meaning that no number (of the appropriate
> type) handled by a C program will ever be greater than the appropriate
> constant.  For example:
> 
> int min_val;
> 
> ...
> 
> min_val = INT_MAX; /* INT_MAX used as a surrogate infinity */
> for(i = 0; i < ITER; ++i) {
>   if ( min_val > arr[i] ) {
>     min_val = arr[i];
>   }
> }
> 
> Is there a similar facility in Perl?

Better:

min_val = arr[0];
for(i = 0; i < ITER; i++) {

	if (arr[i]) < min_val) min_val = arr[i];
}

or a perl way:

my $min = shift @array;
foreach my $value (@array) {

	$min = $value if $value < $min;
}

Why is the latter more readable? :-D.

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



------------------------------

Date: Mon, 08 Sep 2003 19:26:42 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: "Surrogate infinity" in Perl?
Message-Id: <1063042107.752601@halkan.kabelfoon.nl>

John Bokma wrote:

> min_val = arr[0];
> for(i = 0; i < ITER; i++) {

should read: i = 1 and assumes array has at least 2 values...




-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



------------------------------

Date: Mon, 08 Sep 2003 15:36:31 GMT
From: "Ganchrow Harris Peck" <ganchrow@nospam.com>
Subject: Re: Bizarre SvTYPE after fork on W2K Server
Message-Id: <3m17b.19611$x_5.18603@twister.nyc.rr.com>

"Ganchrow Harris Peck" <ganchrow@nospam.com> wrote in message
news:4H07b.89212$ev.18680665@twister.nyc.rr.com...
> "Ganchrow Harris Peck" <ganchrow@nospam.com> wrote in message
> news:er07b.19607$x_5.9268@twister.nyc.rr.com...
> > Running ActivePerl 5.8.0 build 806 on Winows2K Server SP4.
> >
> > A particular program I run tries once per day to fork off a process.
It's
> > always worked before but has now recently stopped.
> >
> > The syntax of the perl code is:
> >      exec($CMD_vb) unless fork;
> >
> > The child process never starts and the parent immediately terminates.
> >
> > The error I get is Bizarre SvTYPE [53] at script.pl line ###.
> >
> > Any idea what could possibly have suddenly caused this to occur?
> >
>
> Interestingly enough (well interesting to me anyway) this Bizarre SvTYPE
> error does not occur with the command:
>
> system(1, $CMD);
>
> which I thought did exactly the same thing as
>
> exec($CMD) unless fork;
>
>


OK, how about this:

sub myfork {  fork; }

When the myfork sub is called as
  &myfork;

I get a windows error.

When it's called as:
  &myfork();

No error.

Hmm ...


-- 
To e-mail me directly, please change "nospam" in my e-mail address to
"yahoo".

Thanks,
Ganchrow




------------------------------

Date: 8 Sep 2003 08:16:41 -0700
From: afayfman@mwh.com (Sashafay)
Subject: Re: Call PL/SQL procedure from Perl - DBI
Message-Id: <a13f8a22.0309080716.128c3f63@posting.google.com>

Ron Reidy <r_reidy@comcast.net> wrote in message news:<3F5BC057.4040600@comcast.net>...
> perldoc DBD::Oracle
> 
> Sashafay wrote:
> > Hi,
> > 
> > How I can call PL/SQL store procedure from Perl - DBI script?
> > 
> > Thanks in advance,
> > Alex


Thanks Guys!

Regards,
Alex


------------------------------

Date: 8 Sep 2003 09:21:44 -0800
From: uj797@victoria.tc.ca (Arthur T. Murray)
Subject: Re: Cautionary Note (was): AI::GA
Message-Id: <3f5cac98@news.victoria.tc.ca>
Keywords: computer architecture, computer intelligence, computer programming

Kent Paul Dolan wrote in news:comp.lang.perl.misc on Mon, 8 Sep 2003:

> Don't pretend that you are going to be the architect, 
> be content to add a few bricks to the edifice and 
> call that a life's work.  That's the only way the 
> real work of science ever gets done.

Kent, you are right and I agree wholeheartedly with you.
Although I am a gold-bricker at heart and I ask AI-eager
individuals to send me $1+ and corps $1K+ via KWAI below
to keep the all-consuming independent-scholar AI Werk going,
adding "a few bricks to the edifice" is the K.P.-Dolanesque idea:
http://mentifex.virtualentity.com/cpp.html -- C++ with new AI code;
http://mentifex.virtualentity.com/java.html -- see "Mind.JAVA #001";
http://mentifex.virtualentity.com/lisp.html -- Lisp AI Weblog;
http://mentifex.virtualentity.com/perl.html -- first Perl module;
http://mentifex.virtualentity.com/prolog.html -- Prolog AI Weblog;
http://mentifex.virtualentity.com/python.html -- Python AI Weblog;
http://mentifex.virtualentity.com/ruby.html -- Ruby AI Blog (OO AI);
http://mentifex.virtualentity.com/scheme.html -- "Scheme AI Weblog;
http://mentifex.virtualentity.com/vb.html -- see "Mind.VB #001" link.

Of course, we also need to rewrite all the old pre-AI4U textbooks
and even the various books on the art of computer programming,
so that students in the peri-Singularity epoch will learn
AI techniques directly when the book examples are AI problems.

AI has been solved; now let's work on the full implementation.

A.T. Murray
--
http://doi.acm.org/10.1145/307824.307853 -- ACM SIGPLAN Notices;
http://www.sl4.org/archive/0205/3829.html -- comments by Dr. B.G.
http://www.amazon.com/exec/obidos/ASIN/0595654371/ -- AI textbook
http://www.kurzweilai.net/mindx/profile.php?id=26 - KWAI Mind-X.


------------------------------

Date: Mon, 8 Sep 2003 15:24:47 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: emulating @+ and @-
Message-Id: <bji6vv$11pp$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Tassilo v. Parseval
<tassilo.parseval@post.rwth-aachen.de>], who wrote in article <bjhua3$kkv$1@nets3.rz.RWTH-Aachen.DE>:
> That's smart. I think that this will make it easy to solve my problem.
> 'struct regexp' (among others) holds
> 
> 	U32 nparens;		/* number of parentheses */
> 	U32 lastparen;		/* last paren matched */
> 	U32 lastcloseparen;	/* last paren matched */
> 
> One of those (or even all of them) is probably what I am looking for.

Keep in mind that struct regexp is used for *two* purposes (I did not
have time to clean this when working with REx engine): it keeps a part
of the state during the match process, and it keeps the info used for
$<digit> etc *after* the match.  Be sure to use only the entries
mentioned in mg.c.

Yours,
Ilya



------------------------------

Date: Mon, 8 Sep 2003 08:58:01 -0700
From: "Trent Curry" <tcurrey@no.no.no.i.said.no>
Subject: Re: exit() argument evaluation
Message-Id: <bji92f$npj$1@news.astound.net>

"John W. Krahn" <krahnj@acm.org> wrote in message
news:3F5C4F58.A0C4CD38@acm.org...
> "Dr. Peter Dintelmann" wrote:
> >
> >     perl -le 'print 4==7 ? 0 : 1'
> >
> > produces "1" as output and
> >
> >     perl -e 'die 4==7 ? 0 : 1'
> >
> > produces "1 at -e line 1.". But
> >
> >     perl -e 'exit 4==7 ? 0 : 1'
> >
> > sets the exit code to 4 instead of 1 (using brackets around the
> > argument of exit() changes this).
> >
> > Is there any reason for this behaviour?
>
>
> perldoc perlop
> [snip]
>            nonassoc    named unary operators
>            nonassoc    < > <= >= lt gt le ge
>            nonassoc    == != <=> eq ne cmp
>            left        &
>            left        | ^
>            left        &&
>            left        ||
>            nonassoc    ..  ...
>            right       ?:
>            right       = += -= *= etc.
>            left        , =>
>            nonassoc    list operators (rightward)
>
>
> exit (a named unary operator) has higher precedence than == while print
> and die (list operators (rightward)) have lower precedence.

Quite right. So the moral of this story is, when in doubt, add a set of ()'s
the expression in question:

   perl -e 'exit (4==7 ? 0 : 1)'




------------------------------

Date: Mon, 08 Sep 2003 18:05:53 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Help configuring Perl with Apache 2
Message-Id: <1063037258.368228@halkan.kabelfoon.nl>

Cyde Weys wrote:

> Technically, a chmod on a directory doesn't even have to do with the 
> configuration of Apache ... just the directory attributes of your 
> filesystem.

Which can be made so that Apache can not use the directory at all....


-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



------------------------------

Date: Mon, 08 Sep 2003 18:12:53 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Help configuring Perl with Apache 2
Message-Id: <1063037678.762317@halkan.kabelfoon.nl>

Tad McClellan wrote:

> Cyde Weys <cyde@umd.edu> wrote:

>>I just asked what was the 
>>point of saying *plonk* 
> 
> So that the lurkers will know what price they may pay should
> they ever feel the urge to post their server setup questions here.

A *plonk* is as off topic as the original post and hence adds to the noise.

Just ignore off topic posts and don't reply in any way.

Most off topic posters are looking for quick solutions and hence will 
leave when no one replies. Some will discuss *plonk*s and other angry 
reactions at greath length and thus add more and more to the noise often 
feeded by people who wanted to prevent this noise in the first place.

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



------------------------------

Date: Mon, 08 Sep 2003 16:24:54 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Help configuring Perl with Apache 2
Message-Id: <20030908122455.7cce04b0.jwillmore@cyberia.com>

On Mon, 08 Sep 2003 00:57:09 -0400
Cyde Weys <cyde@umd.edu> wrote:
> James Willmore wrote:
> 
> > Try 'chomd -Rv 755 <your cgi-bin directory>'.
> 
> That's not the problem.  The directory my .pl file was in and the
> .pl file itself were already set to executable.  The problem was
> that I didn't have Options +ExecCGI specified in the right place to
> override the "no overrides" put on the root /var/www/html directory.

Yes, it is :)  403 errors are caused when Apache can _not_ access a
file _or_ a directory.  Please take the time to research this in an
Apache USENET group _or_ read the documentation.  I speak from
experience on this ... because I have done the same thing ;)

Just putting in "Options +ExecCGI" is a "quick fix".  You _may_ be
able to run script from the directory indicated, but this is because
the permissions are set to 755 (drwxr-xr-x). 

> > Again, this issue lies with your configuration of Apache, _not_
> > with Perl.
> 
> Technically, a chmod on a directory doesn't even have to do with the
> 
> configuration of Apache ... just the directory attributes of your 
> filesystem.

In any event, this is not Perl.  
In the future, post to an Apache USENET group -or- visit
http://apache.org

There are_lots_ of documents there that will aid you, as well as
resources to avail yourself to.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Adult, n.:  One old enough to know better. 



------------------------------

Date: Mon, 08 Sep 2003 16:38:24 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Help configuring Perl with Apache 2
Message-Id: <20030908123826.5018c98d.jwillmore@cyberia.com>

On Mon, 08 Sep 2003 00:50:49 -0400
Cyde Weys <cyde@umd.edu> wrote:
> James Willmore wrote:
> > On Sun, 07 Sep 2003 19:17:06 -0400
> > Cyde Weys <cyde@umd.edu> wrote:
> >>John Bokma wrote:
> >>>If CGI.pm defaults to XHTML I consider this a bit odd. Maybe even
> >>>bad.
> >>
> >>This does appear to be the case.  I am simply doing "print
> >header;">and it is assuming I want to use XHTML (which I don't, I
> >don't even>know how to use it).  Does anyone know how to tell
> >CGI.pm to use>different headers, i.e. HTML 4.1?  Thanks.
> > Yes.
> > perldoc CGI
> Hehe, someone had said that to me before, but I didn't know what
> they were talking about.  I didn't realize it was literally a
> command you could type into the command line.

http://perldoc.com
No command line required - just a browser :)

http://search.cpan.org
Again, no command line required -  just a browser:)

You could also use the 'man' command on *NIX systems.  'man -k
<keyword>' if you use Linux of have the GNU version of 'man' 
'apropos' also works well :)

On Windows, the ActiveState install comes with HTML files that have
the documentation :)

> 
> Anyway, I didn't use perldoc because I wanted something searchable. 
> So I looked for the Perl CGI.pm manual online - which I found - and
> came up with the following gem:
> 
> 
> 
> -no_xhtml
>      By default, CGI.pm versions 2.69 and higher emit XHTML 
> (http://www.w3.org/TR/xhtml1/). The -no_xhtml pragma disables this 
> feature. Thanks to Michalis Kabrianis <kabrianis@hellug.gr> for this
> 
> feature.
> 
> I don't know what a pragma is, but by following the examples, I was
> able to work it into my program and now I'm using HTML 4!  Also, it
> got rid of the annoying slashes after text problem (ie <br />
> instead of just <br>) ... I was wondering what was causing that!

<sigh>
http://www.w3c.org

Has the standards for HTML and a lot of other "stuff" for use on the
Internet (ex HTML, HTTP, XML, etc.)

The "annoying slash" is part of the standard for XHTML.  It's
_supposed_ to be there.  It can also be used in HTML 4.x.

> 
> > And, while you're at it, you should research the various RFC's and
> > FAQ's available
> > http://www.w3c.com/
> > 
> > And, I take it you're a college student, yes?
> 
> Yes.
> 
> > Read, read, read.  Learn, learn, learn.
> 
> "Read" is only one of the many steps of the "learning" process. 
> There's also "ask" and "listen".
> 
> Also, I forgot my Perl book at home --- GRRRRRRR.  I'm having my
> parents ship it to me.
> 
> > There's lots of material out there to aid you - take advantage of
> > this fact.
> 
> Thanks for the help, material :-)
> 

You _don't_ need the books ... they are written from the Perl
documentation :)  They _aid_ you in learning, but _don't_ rely on the
as the sole source of information.  Otherwise, you'll be broke and
kicking yourself latter when you find that the documentation for Perl
has _most_ if not _all_ of what you need.  Again, from my experience.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
ADA, n.:  Something you need only know the name of to be an
Expert in Computing.  Useful in sentences like, "We had better
develop an ADA awareness." 


------------------------------

Date: Mon, 8 Sep 2003 15:17:32 +0000 (UTC)
From: Vlad Tepes <minceme@start.no>
Subject: Re: Newbie Q: MacPerl / CGI woes
Message-Id: <bji6ic$a4m$1@troll.powertech.no>

will@meister.com <will@meister.com> wrote:

> I'm working with the classic Matt Wright Simple Search CGI, which I
> intend to modify somewhat. Mods are going well, but my ISP is not set
> up for Perl support, so I've installed MacPerl with an old copy of
> QuidProQuo on my own machine on a dummy IP address. Although the CGI
> is working well enough to echo search arguments, I can't get it to see
> the search files.

Don't use Matt's scripts. They contain errors and security holes. Look
for drop-in replacements made by experts at http://nms-cgi.sf.net .

The rest of your mail I didn't bother looking at. I'm willing to help,
but not with scripts Matt Wright himself warns about using.

Hope this helps,
-- 
Vlad



------------------------------

Date: Mon, 8 Sep 2003 10:02:34 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Newbie Q: MacPerl / CGI woes
Message-Id: <slrnblp6ga.iks.tadmc@magna.augustmail.com>

will@meister.com <will@meister.com> wrote:

> @files = ('*.htm');


If @files contains no elements, then this code will
have an identical effect:

   $files[0] = '*.htm';

Where the first character of the filename is an asterisk character.


> What am I doing wrong?


I dunno (because you did not show how you are using @files).

Try expanding the glob:

   my @files = glob '*.htm';


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 8 Sep 2003 10:03:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Newbie Q: MacPerl / CGI woes
Message-Id: <slrnblp6is.iks.tadmc@magna.augustmail.com>

will@meister.com <will@meister.com> wrote:

> This is a real clueless newbie-type question:

> I'm working with the classic Matt Wright Simple Search CGI,


Don't do that.

Crappy code is not a good starting point for beginners (nor experts).


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 08 Sep 2003 16:08:21 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Problem with simple contact script.
Message-Id: <20030908120823.4caa0ff4.jwillmore@cyberia.com>

On 08 Sep 2003 06:35:13 GMT
mortgageloan2003@aol.com (Mortgageloan2003) wrote:
> I have a form below - I put a radio button for the person to select
> who they want to email to instead of "hardcoding" this into the
> form.  (thus the spammers can't get my email addresses) the email
> addresses are set in the script via an if elsif test. I run this on
> my Windows XP port of perl with the-w and it simply can't find the
> path. I get an error 500 on the webserver.  I can't figure this out.
>  I'm only a novice programmer.  Any help is appreciated.

What shows up in the error server logs?

> 
> Script:
> 
> #!usr/bin/perl

add:
use strict;

> use CGI qw(param);
> $towhom= param("towhom");

change to:
my $towhom= param("towhom");

> $name= param("name");

change to:
my $name= param("name");

> $email= param("email");

change to:
my $email= param("email");

> $comments= param("comments");

change to:
my $comments= param("comments");

> if ($towhom  eq "loanofficer") {
> 	$towhom = "loanofficer\@mortgage-pros.com";
> } elsif ($towhom eq "marketing") {
> 	$towhom="marketing\@mortgage-pros.com";
> } elsif ($towhom eq "broker") {
> 	$towhom="broker\@mortgage-pros.com";
> }
> open(SM,"|/usr/sbin/sendmail -oi -t");

You mention running this on a Windows XP platform.  Is this valid for
your sendmail?

Just a suggestion - DO _NOT_ cut and paste code _unless_ you
understand _why_ you're cutting and pasting.  My guess is that ... you
don't have sendmail on your system.

Check your web server error logs and see if they show what the error
is.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Somebody ought to cross ball point pens with coat hangers so that
the pens will multiply instead of disappear. 


------------------------------

Date: Mon, 08 Sep 2003 17:52:21 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: simple regex problem
Message-Id: <3F5CC1DE.D90E2BF4@acm.org>

Gunnar Hjalmarsson wrote:
> 
> John W. Krahn wrote:
> > JS wrote:
> >> I'm trying to build a regex to put the department name into a
> >> variable $dept and the rest of the line into another variable
> >> $stats:
> >>
> >>E-Test                  3       -       4       -
> >>Health and Safety       -       1       1       -
> >>Finance                 -       3       -       -
> >
> > my ( $dept, $stats ) = unpack 'A24 A*', $_;
> 
> That doesn't work for the E-Test line. How about:
> 
>      my ($dept, $stats) = /(.+[a-z])\s+(.*)/;

Sorry, "doesn't work" is not enough information for me to fix the
problem.


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Mon, 08 Sep 2003 17:55:50 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: simple regex problem
Message-Id: <3F5CC2AE.FFEBC101@acm.org>

JS wrote:
> 
> John W. Krahn wrote:
> > JS wrote:
> >
> >>I'm trying to build a regex to put the department name into a variable
> >>$dept and the rest of the line into another variable $stats:
> >>
> >>E-Test                  3       -       4       -
> >>Health and Safety       -       1       1       -
> >>Finance                 -       3       -       -
> >>
> >>This is my regex:
> >>
> >>($dept,$stats)=/^(.[^\s-|\d]*)\s+(.*)/;
> >>
> >>but it doesn't work because of the \s- is not actually handled as a
> >>string, but individual charaters.
> >>
> >>Can anyone fix this for me please?
> >
> > my ( $dept, $stats ) = unpack 'A24 A*', $_;
> 
> The problem with that is if the dept name is longer than 24 characters e.g:


my @fields = split /(\s{2,})/;
my $dept = shift @fields;
shift @fields;
my $stats = join '', @fields;



John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 5464
***************************************


home help back first fref pref prev next nref lref last post