[17878] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 38 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 11 11:05:33 2001

Date: Thu, 11 Jan 2001 08:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979229109-v10-i38@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 Jan 2001     Volume: 10 Number: 38

Today's topics:
        A RegEx question <merl@softhome.net>
        Archive::Zip - any user comments? <geoff-at-farmline-dot-com@127.0.0.1>
    Re: CGI vs Javascript dropdowns <eric.kort@vai.org>
    Re: data structure syntax (Anno Siegel)
    Re: data structure syntax (Greg Bacon)
    Re: data structure syntax <aqumsieh@hyperchip.com>
    Re: data structure syntax (Anno Siegel)
        Help with array manipulation <wherberzt@earthliznk.zet>
    Re: How do I convert %40 to '@' ? (Tad McClellan)
    Re: how to use HTML::Parser (Daniel Chetlin)
    Re: HTML stripper (James Kufrovich)
    Re: left op of && and || only in scalar context ? (Anno Siegel)
    Re: Licensing a program written perl? thebigmarkus@my-deja.com
    Re: Maybe more of a unix question. Translating file nam <tzz@beld.net>
    Re: Pb with cgi script written in perl <a.peacock@chime.ucl.ac.uk>
    Re: Perl code to convert C++ strings to unidode strings <bart.lateur@skynet.be>
    Re: Problem with inserting data (Tad McClellan)
        regex help, please (Stan Brown)
    Re: regex help, please (Bernard El-Hagin)
    Re: regex help, please (Bernard El-Hagin)
    Re: regex help, please (Greg Bacon)
    Re: replacing spaces with %20 <mischief@velma.motion.net>
    Re: Strange ? <nickco3@yahoo.co.uk>
    Re: Syntac of passing a hash to a subroutine? (Stan Brown)
    Re: System() redirection failing in Win98, WinME (Duncan Murdoch)
    Re: would a regex be helpful here? <webqueen@my-deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 11 Jan 2001 17:54:48 +0200
From: "Vladimir Georgiev" <merl@softhome.net>
Subject: A RegEx question
Message-Id: <3a5dd8cd_3@news2.prserv.net>

I have a string like: "ShowPic('01.jpg',281,41)" which is a part of a
Javascript.
I wanted to increase the two numbers by 10 and tried the following code:

$a =~ s/(ShowPic\('\d{1,3}\.jpg',)(\d{2,4}),(\d{2,4})\)/$1,$2+10,$3+10)/;

but the output was:
(...,281+10,41+10)
and not (...,291,51) as I expected.

It seems that the expression is always interpreted as a string.
Any ideas how to make it add the numbers? Or other ways to do it?

Vladimir




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

Date: Thu, 11 Jan 2001 15:27:04 -0000
From: "Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1>
Subject: Archive::Zip - any user comments?
Message-Id: <93kj9s$sdv$1@soap.pipex.net>

Has anyone any idea how good Archive::Zip is - it's only at 0.09 which
doesn't instil huge amounts of confidence, but then it hasn't changed since
May - which probably either means it's working ok or the author has given up
on it (!!)

Ta

Geoff




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

Date: Thu, 11 Jan 2001 09:11:58 -0500
From: "Eric" <eric.kort@vai.org>
Subject: Re: CGI vs Javascript dropdowns
Message-Id: <93kfh3$1b87$1@msunews.cl.msu.edu>


"Dave Brondsema" <brondsem@my-deja.com> wrote in message
news:93j6ru$2it$1@nnrp1.deja.com...
> In article <93fone$2ire$1@msunews.cl.msu.edu>,
>   "Eric" <eric.kort@vai.org> wrote:
> > CGI is the ONLY route for generating interactive web pages on the
> fly, but
> To an extent, interactive web pages can be generated via client side
> scripting like JavaScript.  They are limited because they can't read a
> database or file, but they can dynamically generate the page.  A simple
> example is web pages that have a JavaScript popup input window asking
> for your name.  When the page loads, it says "Welcome, John Doe".  And
> then JavaScript reads/sets a cookie and the page continues by
> displaying: "You have been here 3 times."

Ah.  Good point.  So in that sense, client side JavaScript is an alternative
to server side CGI.

But the main point that is often obfuscated in the minds of us novices is
that Perl and Java are not alternatives to CGI, they are methods of
implementing the CGI protocol.

(And, the example you give highlights the hazards of client side
cute-ness....John doe may have accessed the page a hundred times from a
different machine--something you can only detect with server side scripting
via CGI, or ActiveServer, or whatever your flavor of server uses).

Anyhow, thanks for the clarification.

Eric




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

Date: 11 Jan 2001 14:11:03 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: data structure syntax
Message-Id: <93ketn$jb3$2@mamenchi.zrz.TU-Berlin.DE>

 <egwong@netcom.com> wrote in comp.lang.perl.misc:
>Jeff Stampes <stampes@xilinx.com> wrote:
>> Greg Bacon wrote:
>
>>>      <robr@sitera.com> wrote:
>>>
>>> : If I have:
>>> :
>>> : my $ref = {
>>> :              "foo"    =>  [ "0", "1" ]
>>> :           };
>>> :
>>> : what would be the syntax to push "2" onto the anonymous array?
>>>
>>> push @{ $ref{foo} }, 2;
>
>This is missing a '$'.  It should be
>	push @{$$ref{foo}}, 2;
>
>otherwise we're referring to %ref (the hash) rather than $ref
>(the scalar reference.)

Did you test that?  Greg's code is fine, yours is in error.

Anno


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

Date: Thu, 11 Jan 2001 14:52:39 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: data structure syntax
Message-Id: <t5ri5nenbdgbc4@corp.supernews.com>

In article <93ketn$jb3$2@mamenchi.zrz.TU-Berlin.DE>,
    Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

:  <egwong@netcom.com> wrote in comp.lang.perl.misc:
:
: >This is missing a '$'.  It should be
: >	push @{$$ref{foo}}, 2;
: >
: >otherwise we're referring to %ref (the hash) rather than $ref
: >(the scalar reference.)
: 
: Did you test that?  Greg's code is fine, yours is in error.

No, egwong is right, and I was wrong. :-(

Greg
-- 
Any sufficiently complicated C or Fortran program contains an ad hoc
informally-specified bug-ridden slow implementation of half of Common Lisp.
    -- Philip Greenspun


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

Date: Thu, 11 Jan 2001 15:38:45 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: data structure syntax
Message-Id: <7an1cyqet4.fsf@merlin.hyperchip.com>


Jeff Stampes <stampes@xilinx.com> writes:

> Greg Bacon wrote:
> 
> >      <robr@sitera.com> wrote:
> >
> > : If I have:
> > :
> > : my $ref = {
> > :              "foo"    =>  [ "0", "1" ]
> > :           };
> > :
> > : what would be the syntax to push "2" onto the anonymous array?
> >
> > push @{ $ref{foo} }, 2;
> >
> > See the perldsc and perllol manpages.
> 
> Good advice, but unless my debugger misleads me, wrong answer (and Ala as
> well...makes me worry about my debugger!).

You are right. I didn't notice the curly braces. The correct answer is,
ofcourse:

	push @{$ref->{foo}}, 2;

which only confirms that I should test every snippet of code, no matter
how simple it might be, before posting!

--Ala


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

Date: 11 Jan 2001 15:41:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: data structure syntax
Message-Id: <93kk6m$q7q$1@mamenchi.zrz.TU-Berlin.DE>

Greg Bacon <gbacon@hiwaay.net> wrote in comp.lang.perl.misc:
>In article <93ketn$jb3$2@mamenchi.zrz.TU-Berlin.DE>,
>    Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
>:  <egwong@netcom.com> wrote in comp.lang.perl.misc:
>:
>: >This is missing a '$'.  It should be
>: >	push @{$$ref{foo}}, 2;
>: >
>: >otherwise we're referring to %ref (the hash) rather than $ref
>: >(the scalar reference.)
>: 
>: Did you test that?  Greg's code is fine, yours is in error.
>
>No, egwong is right, and I was wrong. :-(

Indeed.  I don't know what I was thinking, far less what I was
testing.

Anno


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

Date: Thu, 11 Jan 2001 14:58:32 GMT
From: "wherbert" <wherberzt@earthliznk.zet>
Subject: Help with array manipulation
Message-Id: <sSj76.6495$mX.191794@newsread2.prod.itd.earthlink.net>

Hello there, thanks for taking the time to read my dribble... I am
attempting to grab multiple consecutive form data using the same =>name
space , parse it and send it off to database handlers...
If the user specifies the number of forms to be 3 I loop the following code
to the server 3 times...

for(1..param('num_ent')) {
        print $q->textfield({-name=>"prim",-size=>"4",
                -value=>"PEXT"});
        print $q->textfield({-name=>"last",-size=>"15",
                -value=>"Last name"});
        print $q->textfield({-name=>"first",-size=>"15",
                -value=>"First name"});
        print $q->textfield({-name=>"dept",-size=>"15",
                -value=>"Department"});
        print $q->popup_menu({-name=>"sw_loc",-size=>"1",
        -value=>['Brigantine','Flagship','APDeeding','APHOT','SW Location'],
                -default=>'SW Location'});
        print $q->popup_menu({-name=>"card",-size=>"1",
                -value=>[1..200,'Card#'], -default=>'Card#'});
        print $q->popup_menu({-name=>"port",-size=>"1",
                -value=>[1..16,'Port#'], -default=>'Port#'}),"<BR>";
                if (param('snum_ent')){
                        if ($i / 2 !~ /\\./){ $t = 0;}
                print "<TABLE ALIGN=CENTER><TR><TD>";
                for(1..param('snum_ent')){
                print "<TR><TD>" if ($t==4||$t==8||$t==12);
                        print
$q->textfield({-name=>"sex".$i.++$t,-size=>"4",
                        -value=>"SEXT"});
                print "</TR></TD>" if ($t==4||$t==8||$t==12);
                }
                print "</TR></TD></TABLE>";
                                }
                }

Thats the easy part, the part im stuck on is extracting the values in the
correct order. The fillout
form looks like this as textfields with default values:

PEXT    Last Name    First Name    Department    Switch Location    Card#
Port#
PEXT    Last Name    First Name    Department    Switch Location    Card#
Port#
PEXT    Last Name    First Name    Department    Switch Location    Card#
Port#

Ive been playing with the following to parse it...
foreach $mypar ($q->param){
                if ($mypar ne $q->param('Commit')){
                        push (@wrk, join (' ',$q->param($mypar), "\n"));
                                                }
                                        }
 foreach $twrk (@wrk) {
                        print $twrk, $q->br();
                                        }
out put from this looks like:

PEXT PEXT PEXT
Last name Last name Last name
First name First name First name
Department Department Department
SW Location SW Location SW Location
Card# Card# Card#
Port# Port# Port#

If you where to read this from top of column 1 'PEXT' down to 'PORT' in
column 1 where $wrk[0] is PEXT PEXT PEXT the  first PEXT being column1 and
the third being column 3. I am trying to assemble the values of each column
in order from left to right on a single line. In other words turn the
columns into rows and send them off to a statement handle for interaction
with a database.
Any pointers are greatly appreciated.





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

Date: Thu, 11 Jan 2001 07:09:12 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How do I convert %40 to '@' ?
Message-Id: <slrn95r8j8.b8i.tadmc@tadmc26.august.net>

Merlin <robert@chalmers.com.au> wrote:

>I thought there must be some way of escaping (unescaping?) the data that
>comes in from the web page form though, rather than having to convert each
>item.


There is.

You have already been told (more than once even) what that way is!

Are you ignoring the good advice you have gotten?

>Doesn't really matter here though, as ther is onnly the one item.


It will matter as soon as you get an email address that has
some character other than at-sign that is escaped.

   perldoc CGI

   perldoc CGI

   perldoc CGI


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


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

Date: 11 Jan 2001 13:53:26 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: how to use HTML::Parser
Message-Id: <93kdsm027iq@news2.newsguy.com>

On Thu, 11 Jan 2001 10:14:46 GMT,
 Bart Lateur <bart.lateur@skynet.be> wrote:
[snip]
> Now, back to your original question: You make a new package, in it,
> require (or use) HTML::Parser, put 'HTML::Parser', the string, in
> @ISA, and then simply define the subs for your standard methods, and
> maybe some more of your own.

HTML::Parser no longer requires subclassing. Its version 3 API is based
around registering callbacks for certain events, which is much easier to
work with.

Here is a simple example, using the "new" API (it's over a year old by
now) that strips all HTML from its given input.

  use HTML::Parser ();
  my $parser = HTML::Parser::->new(api_version => 3);
  $parser->handler(text => sub { print @_ }, 'text');
  $parser->parse($_) while <>;
  $parser->eof;

I should note that Bart's suggestion of playing with HTML::TokeParser
first is a good one. Here is a simple example of TokeParser doing the
same:

  use HTML::TokeParser ();
  my $parser = HTML::TokeParser::->new( shift || *STDIN);
  while (my $token = $parser->get_token) {
    next unless $token->[0] eq 'T';
    print $token->[1];
  }

-dlc


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

Date: Thu, 11 Jan 2001 15:38:43 GMT
From: eggie@REMOVE_TO_REPLYsunlink.net (James Kufrovich)
Subject: Re: HTML stripper
Message-Id: <slrn95rl0n.bq3.eggie@melody.mephit.com>

On Thu, 11 Jan 2001 02:17:11 GMT, Jeff Helman <jhelman@wsb.com> wrote:
>
>Use the standard parsing modules.  Unless the HTML you are parsing is
>very clean (i.e., you generated it or some other program that you
>understand did), parsing HTML using RegExs is not worth wasing your
>time on.

	And so I'm enlightened.  I grabbed the HTML-Parser module and I'll
look through its docs.  Thanks for the tip.

Jamie, who really should learn to stop trying to re-invent code...

-- 
Egg, eggie@REMOVE_TO_REPLYsunlink.net
FMSp3a/MS3a A- C D H+ M+ P+++ R+ T W Z+ 
Sp++/p# RLCT a+ cl++ d? e++ f h* i+ j p+ sm+


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

Date: 11 Jan 2001 14:35:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: left op of && and || only in scalar context ?
Message-Id: <93kgam$jb3$3@mamenchi.zrz.TU-Berlin.DE>

Bart Lateur  <bart.lateur@skynet.be> wrote in comp.lang.perl.misc:
>Stephen Collyer wrote:
>
>>In an expression like:
>>
>>EXPR1 || EXPR2
>>
>>or:
>>
>>EXPR1 && EXPR2
>>
>>EXPR1 only is evaluated in scalar context.
>>It's not clear to me why EXPR2 isn't evaluated in
>>scalar context too - anyone know why ?
>
>	@a = 0 || localtime;
>	print "@a\n";
>-->
>	10 59 14 11 0 101 4 10 0
>
>Eek! You're right. This doesn't make any sense.

Uh, indeed.  When a chain of boolean operations is in list context,
so is the last (and only the last) expression in the chain.  At
least that's what some tests seem to show.  As you say, it makes
no sense.

Anno


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

Date: Thu, 11 Jan 2001 15:24:22 GMT
From: thebigmarkus@my-deja.com
Subject: Re: Licensing a program written perl?
Message-Id: <93kj6q$5rj$1@nnrp1.deja.com>

In article <93k4id$piv$1@nnrp1.deja.com>,
  jbuff <jbuff1856@my-deja.com> wrote:

> Give the program away. Sell the support.
>
> --jbuff

Or host the application on your server.

TBM


Sent via Deja.com
http://www.deja.com/


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

Date: 11 Jan 2001 10:06:21 -0500
From: Ted Zlatanov <tzz@beld.net>
Subject: Re: Maybe more of a unix question. Translating file names
Message-Id: <m3elyat9g2.fsf@heechee.beld.net>

usad1@gadnet.com (G.A.D.Miles) writes:

> I am trying to write a little web traffic tracker in Perl. The way it
> works at the moment the script takes the host name and the document
> name / path and sticks them together with a bit of dummy text in
> between. Then it changes all /s to .s to create a file name. Like
> this:
> 
> Host name: www.domain.com
> File path: /personal/me.html
> End result: www.domain.comDUMMYTEXT.personal.me.html
 ...
> One current problem with my approach is that it can't cope with
> directory name which contain .s. Eg:

> Any ideas? Ideally I would like it to work on any platform including
> NT, although I am testing it on unix FreeBSD.

One way is to use the URI::Escape module.  You can pass the
uri_escape() function a range of characters that are "unsafe," and the
documentation even has an example that escapes absolutely everything.
As long as your OS can handle filenames with the characters you deem
safe, and numbers and the "%" character, and it can handle long
filenames, you should be fine.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Thu, 11 Jan 2001 14:14:52 +0000
From: Anthony Peacock <a.peacock@chime.ucl.ac.uk>
Subject: Re: Pb with cgi script written in perl
Message-Id: <3A5DBFDC.A54D327@chime.ucl.ac.uk>

Jean-Luc BEAUDET wrote:
> 
> Hi every body
> 
> Currently:
> SOLARIS 7 on SUN Ultra5 station
> Apache 1.3.14 installed dynamically (all DSO)
> Perl 5.6.0
> 
> I want CGI scripts written with perl running under Apache.
> Each time i try a real script perl ( "!/usr/local/bin/perl)
> I get a big Internal Server Error
> And the log file give me lines below:
> 
> ld.so.1: /usr/local/bin/perl5: fatal: libgdbm.so: open failed: No such
> file or directory
> [Thu Jan  4 19:30:22 2001] [error] [client 150.248.8.211] Premature end
> of script headers: /home/jlbeaudet/cgi-bin/ListEnv.cgi
> 
> My script ListEnv.cgi runs good in a shell (sh/ksh)
> 
> The libgdbm.so stays in /usr/local/lib , my LD_LIBRARY_PATH feels OK
> and looks like this
> LD_LIBRARY_PATH=/usr/lib/sparcv9:/usr/lib:/usr/local/lib
> export LD_LIBRARY_PATH

Check what the LD_LIBRARY_PATH value is for the environment that Apache
is running in, and specifically the environment that Apache runs CGI
scripts in.  You will most likely need to change your Apache config.


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

Date: Thu, 11 Jan 2001 15:27:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl code to convert C++ strings to unidode strings?
Message-Id: <9tjr5toqnnkjpqksbb3g56h2av0egf3499@4ax.com>

Ryan Tanner wrote:

>Anybody got some perl code to convert c++ characters and strings to unicode?
>The C++ code runs on MS-Windows and was developed using Visual C++.

WTF are C++ strings?

Are you talking about plain Windows text?

In principle, modules like Unicode::Map8 (which is based upon
Unicode::String) should allow you to do this, but I just can't seem to
get the hang of that module, and besides, there's no precompiled version
for Win32 on Activestate's site. But, not to worry, writing code to do
that, and pretty fast too, can be done with plain Perl code. All you
need  is the translation table, and you can get such a file from
<http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT>.

But Windows' character set is compatible with ISO-Latin-1, which has the
same character codes as Unicode, apart for its extensions in the 128-159
range. So here's demo code, with essentialities of the conversion, which
prints out its own source in Unicode. Choose a different input file
(@ARGV) and properly redirect the output to a file, and it'sll do what
you want. I think. Alternatively, set $i16 to 'n'.

my $i16 = 'v';  # pack() template endianness; little endian (alt = 'n')
my %unicode = map { chr() => pack $i16, $_ } 0 .. 255;  # default
# patch differences:
while(<DATA>) {
    /^(0x[A-F0-9]+)\s+(0x[A-F0-9]+)/ or next;
    $unicode{chr hex $1} = pack $i16, hex $2;
}

@ARGV = $0;
print pack $i16, 0xFEFF;  # endianness marker
while(<>) {
    s/([\000-\377])/$unicode{$1}/g;
    print;
}

__DATA__
0x80	0x20AC	#EURO SIGN
0x81	      	#UNDEFINED
0x82	0x201A	#SINGLE LOW-9 QUOTATION MARK
0x83	0x0192	#LATIN SMALL LETTER F WITH HOOK
0x84	0x201E	#DOUBLE LOW-9 QUOTATION MARK
0x85	0x2026	#HORIZONTAL ELLIPSIS
0x86	0x2020	#DAGGER
0x87	0x2021	#DOUBLE DAGGER
0x88	0x02C6	#MODIFIER LETTER CIRCUMFLEX ACCENT
0x89	0x2030	#PER MILLE SIGN
0x8A	0x0160	#LATIN CAPITAL LETTER S WITH CARON
0x8B	0x2039	#SINGLE LEFT-POINTING ANGLE QUOTATION MARK
0x8C	0x0152	#LATIN CAPITAL LIGATURE OE
0x8D	      	#UNDEFINED
0x8E	0x017D	#LATIN CAPITAL LETTER Z WITH CARON
0x8F	      	#UNDEFINED
0x90	      	#UNDEFINED
0x91	0x2018	#LEFT SINGLE QUOTATION MARK
0x92	0x2019	#RIGHT SINGLE QUOTATION MARK
0x93	0x201C	#LEFT DOUBLE QUOTATION MARK
0x94	0x201D	#RIGHT DOUBLE QUOTATION MARK
0x95	0x2022	#BULLET
0x96	0x2013	#EN DASH
0x97	0x2014	#EM DASH
0x98	0x02DC	#SMALL TILDE
0x99	0x2122	#TRADE MARK SIGN
0x9A	0x0161	#LATIN SMALL LETTER S WITH CARON
0x9B	0x203A	#SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
0x9C	0x0153	#LATIN SMALL LIGATURE OE
0x9D	      	#UNDEFINED
0x9E	0x017E	#LATIN SMALL LETTER Z WITH CARON
0x9F	0x0178	#LATIN CAPITAL LETTER Y WITH DIAERESIS


-- 
	Bart.


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

Date: Thu, 11 Jan 2001 06:43:08 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Problem with inserting data
Message-Id: <slrn95r72c.b8i.tadmc@tadmc26.august.net>

Damian James <damian@puma.qimr.edu.au> wrote:
>In article <slrn95q305.5hi.tadmc@tadmc26.august.net>, Tad McClellan wrote:
>>Damian James <damian@puma.qimr.edu.au> wrote:

>>>If you
>>>admit to just copying code from random sources in this newsgroup, 
>>                            ^^^^^^^^^^^^^^^^^^^
>>>people who might otherwise give you good advice will killfile you.
>>
>>
>>But the documentation included with a module is not a "random"
>>source. (unless MW has made some Perl modules...)
>>
>
>MW? 


The initials of a guy infamous in the context of "cargo cult".


>Sorry -- "random source" was a poor choice of words on my part.


That was the only point of my followup.

I agreed with everything else you said, so I didn't comment on 
any of it :-)


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


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

Date: 11 Jan 2001 09:44:06 -0500
From: stanb@panix.com (Stan Brown)
Subject: regex help, please
Message-Id: <93kgrm$er7$1@panix3.panix.com>

Could some kind soul point out the error of my ways?

I have a regexy that looks like this:

'[a-z\-A-Z_0-9 .#/%\(\)]{1,32} '

I am using this a the pattern for Parse::Lex to scan for. I intend for it
to accept ALL of the folowing:
Any Alph character (upper or lower case),
Any number,
The folowing non aplhanumeric charcaters .#/()%

It just failed to trigger on the token "150/35# LETD"

Can someone tell me what I'm doing incorectly? and how to fix it?

Thanks.



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

Date: Thu, 11 Jan 2001 14:49:14 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: regex help, please
Message-Id: <slrn95rhv8.2q0.bernard.el-hagin@gdndev25.lido-tech>

On 11 Jan 2001 09:44:06 -0500, Stan Brown <stanb@panix.com> wrote:
>Could some kind soul point out the error of my ways?
>
>I have a regexy that looks like this:
>
>'[a-z\-A-Z_0-9 .#/%\(\)]{1,32} '
                  ^
What delimiter did you use for the m// operator? If you used slashes
then the pointed out slash breaks the regex and has to be escaped:

$_ = '150/35# LETD';
print "Yipee" if /[a-z\-A-Z_0-9 .#\/%\(\)]{1,32}/;

output:
Yipee

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print \Bernard'


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

Date: Thu, 11 Jan 2001 14:50:55 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: regex help, please
Message-Id: <slrn95ri2e.2q0.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 11 Jan 2001 14:49:14 +0000 (UTC), Bernard El-Hagin
<bernard.el-hagin@lido-tech.net> wrote:
>On 11 Jan 2001 09:44:06 -0500, Stan Brown <stanb@panix.com> wrote:
>>Could some kind soul point out the error of my ways?
>>
>>I have a regexy that looks like this:
>>
>>'[a-z\-A-Z_0-9 .#/%\(\)]{1,32} '
>                  ^
>What delimiter did you use for the m// operator? If you used slashes
>then the pointed out slash breaks the regex and has to be escaped:
>
>$_ = '150/35# LETD';
>print "Yipee" if /[a-z\-A-Z_0-9 .#\/%\(\)]{1,32}/;
>
>output:
>Yipee

Forgot to mention that within the character class the "(" and ")" aren't
special so you don't have to escape them.

Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print \Bernard'


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

Date: Thu, 11 Jan 2001 15:07:50 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: regex help, please
Message-Id: <t5rj26jq5dmq18@corp.supernews.com>

In article <93kgrm$er7$1@panix3.panix.com>,
    Stan Brown <stanb@panix.com> wrote:

: I have a regexy that looks like this:
: 
: '[a-z\-A-Z_0-9 .#/%\(\)]{1,32} '
: 
: I am using this a the pattern for Parse::Lex to scan for. I intend for it
: to accept ALL of the folowing:
: Any Alph character (upper or lower case),
: Any number,
: The folowing non aplhanumeric charcaters .#/()%

Your pattern matches runs of length n, where n is between 1 and 32,
where each character in the run is one of

  - abcdefghijklmnopqrstuvwxyz
  - ABCDEFGHIJKLMNOPQRSTUVWXYZ
  - 0123456789
  - '_', '-', ' ', '#', '/', '%', '.', '(', ')' 

Note that there are alphabetic characters that aren't present in the
above list.

: It just failed to trigger on the token "150/35# LETD"
: 
: Can someone tell me what I'm doing incorectly? and how to fix it?

Did you forget to escape your slash or change the match delimiter?
It works for me:

      DB<6> x $str =~ m|([a-z\-A-Z_0-9 .#/%\(\)]{1,32})|
    0  '150/35# LETD'

I would write the pattern as m|[-\w .#/%()]{1,32}|.

Hope this helps,
Greg
-- 
Bigamy is having one wife too many. Monogamy is the same.
    -- Oscar Wilde


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

Date: Thu, 11 Jan 2001 16:02:17 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: replacing spaces with %20
Message-Id: <t5rm89gif014ae@corp.supernews.com>

^Jerry <newsgroups@jhorn.cjb.net> wrote:
> hehe.. yeah..

> I had done a table inside a perl script, and it looked perfect in IE..
> I checked it in Netscape, and all I saw was text stuck together..

Netscape does the right thing here. IE is yet again too forgiving
for the standard, in its attempts to make broken things look decent.
I hate to get into a browser flamewar in a Perl group... This is
a good thing for end users viewing possibly broken pages, but a bad
thing for someone testing to see if their code is broken or not.

Use something like HTML::Parse, or WebLint, or HTML Tidy, or
the specs for the version in which you wish to write HTML,
which can be found at http://www.w3.org in case you need to
do that.

> I only used <tr> and no <td> tags... hehe

Not much of a Perl issue, but the <td> (or <th>) tags are not
an optional part of a table row. According to the W3C,

        The TR elements acts as a container for a row of table
        cells. The end tag may be omitted.

Which is to say, you must put your data in a data cell or a
header cell, which are inside the table row.


> Jerry

>> This is because whitespace is not legal in a URL. IE is too
>> forgiving.

>> Cheers,
>> Damian


> Sent via Deja.com
> http://www.deja.com/

-- 
Christopher E. Stith

Disclaimer: Actual product may not resemble picture in ad in any way.



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

Date: Thu, 11 Jan 2001 14:55:09 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Strange ?
Message-Id: <3A5DC94D.7050509@yahoo.co.uk>

Colin Watson wrote:

> Nick Condon <nickco3@yahoo.co.uk> wrote:
> 
>> Waarddebon wrote:
>> 
>>> Now I want to seperate those values again (other way around)
>>> Herefor I use this line:
>>> ($h , $i , $j , $k) = split(/,/ , $all);
>>> 
>>> But this doesn't work... if I  use
>>> print $h\n;
>>> print $i\n;
>>> print $j\n;
>>> print $k\n;
>>> The variables are all empty, does anyone know what is wrong with this ?
>> 
>> I cut and pasted this exact code and it works for me.
> 
> 
> Did you really? I find this highly unlikely:
> 
s/it works for me/the variables aren't empty/g



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

Date: 11 Jan 2001 09:45:55 -0500
From: stanb@panix.com (Stan Brown)
Subject: Re: Syntac of passing a hash to a subroutine?
Message-Id: <93kgv3$g9e$1@panix3.panix.com>

In <m3lmsn19wo.fsf@mumonkan.sunstarsys.com> Joe Schaefer <joe+usenet@sunstarsys.com> writes:

>stanb@panix.com (Stan Brown) writes:

>> 
>> Reference found where even-sized list expected at ./new.pl line 111.
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>Often times just following the recommended fix will 
>do the trick.

	That presuposes that the clueless user understands teh message :-)

	Thanks for helping me out.



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

Date: Thu, 11 Jan 2001 09:50:21 -0500
From: murdoch@fisher.stats.uwo.ca (Duncan Murdoch)
Subject: Re: System() redirection failing in Win98, WinME
Message-Id: <3a5dc61f.254108@newshost.uwo.ca>

On Thu, 11 Jan 2001 00:51:21 GMT, gungeek@my-deja.com wrote in message
<93j028$svi$1@nnrp1.deja.com>:

>In article <3a5db297.16255904@newshost.uwo.ca>,
>  murdoch@fisher.stats.uwo.ca (Duncan Murdoch) wrote:

>>  system("echo Hello! > c:\\temp.txt");
>>  system("echo Hello! > c:/temp.txt");
>>
>> both fail, and don't create the temp.txt file.  

>This works for me
>
>$x = `echo Hello!`;
>open(OUTFILE,'>c:\temp.txt') or die "Couldn't open file $!";
>print OUTFILE $x;
>close OUTFILE;

That works for me too, thanks!  Two problems remain:  the actual
system command sometimes returns an exit code.  It appears to be lost
here.  The other problem is that this is supposed to be very portable
code, and according to someone with much more experience than me,

>Backticks did not work at all on my Win95 machine, and had a number of
>problems on Unix due to shell-dependencies.  They really are best
>avoided.

Do you know if there's a way to get the original version to work under
Windows?

Duncan Murdoch


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

Date: Thu, 11 Jan 2001 14:30:02 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Re: would a regex be helpful here?
Message-Id: <93kg0v$2q8$1@nnrp1.deja.com>

Thanks for the great replies guys.. These are some very interesting
solutions.. I never encountered s/(stuff)/../ or putting a join in a
regex. New curisoties for me :) Would perdocs have this kind of example
or is this more like guru-stuff? Are there websites with more examples
of embedding perlfuncs in regexex's?


HUG,
wq

In article <93ipcv$msi$1@nnrp1.deja.com>,
  webqueen, queen of the web <webqueen@my-deja.com> wrote:
> Say I have an input like:
>
>     1,2,4,6-9,12,15-16,20
>
> which I want to explode into:
>     1,2,4,6,7,8,9,12,15,16,20
>
> in other words, convert each n-m into n,n+1,n+2..,m
>
> I can write a script to do this manually, but I wonder is there any
> regex functionality that might help me?
>
> Hug,
> WQ
>
> --
> WHEN THE CATS ARE HUNGRY...
> RUN FOR YOUR LIVES!
> Alone, only a harmless pet...
> 	One Thousand Strong, They Become a Man-Eating Machine!
> 		-- The Night of a Thousand Cats (1972)
>
> Sent via Deja.com
> http://www.deja.com/
>

--
WHEN THE CATS ARE HUNGRY...
RUN FOR YOUR LIVES!
Alone, only a harmless pet...
	One Thousand Strong, They Become a Man-Eating Machine!
		-- The Night of a Thousand Cats (1972)


Sent via Deja.com
http://www.deja.com/


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 38
*************************************


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