[16183] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3595 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 18:53:58 2000

Date: Mon, 10 Jul 2000 15:53:44 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963269624-v9-i3595@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 10 Jul 2000     Volume: 9 Number: 3595

Today's topics:
        redirection using Location: in Perl CGI script <colinrei@oz.net>
    Re: redirection using Location: in Perl CGI script nw23dh@my-deja.com
    Re: redirection using Location: in Perl CGI script <tony_curtis32@yahoo.com>
    Re: redirection using Location: in Perl CGI script <flavell@mail.cern.ch>
    Re: redirection using Location: in Perl CGI script (John Harden Borwick)
    Re: redirection using Location: in Perl CGI script <flavell@mail.cern.ch>
    Re: redirection using Location: in Perl CGI script nw23dh@my-deja.com
        RegEx and numbers newbie@db-networks.com
    Re: RegEx and numbers (Abigail)
    Re: RegEx and numbers newbie@db-networks.com
    Re: RegEx and numbers <care227@attglobal.net>
    Re: RegEx and numbers (Abigail)
    Re: RegEx and numbers (Tad McClellan)
    Re: RegEx and numbers (Abigail)
    Re: Regex replacing bits & pieces of a string in one sh <lr@hpl.hp.com>
        regular expressions <malenski@cse.buffalo.edu>
    Re: regular expressions <adetalabi@clara.co.uk>
    Re: regular expressions <tony_curtis32@yahoo.com>
    Re: regular expressions (Tad McClellan)
    Re: regular expressions <malenski@cse.buffalo.edu>
    Re: regular expressions <user@host.com>
    Re: regular expressions <uri@sysarch.com>
    Re: regular expressions <aqumsieh@hyperchip.com>
    Re: regular expressions <user@host.com>
    Re: regular expressions <lr@hpl.hp.com>
    Re: regular expressions (Abigail)
    Re: regular expressions (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 3 Jul 2000 00:47:37 -0700
From: "Colin Reinhardt" <colinrei@oz.net>
Subject: redirection using Location: in Perl CGI script
Message-Id: <sm1msb28op3168@corp.supernews.com>

Can the Location: header attribute be used to redirect with a relative path?
I haven't been able to get this to work.
What I'm trying to do is redirect the user to another webpage in the same
directory as the CGI script...

The following works fine: (fully specified URL)

print "Location: http://someserver/somepage/index2.html\n\n"; ### Redirect

but these other ways seem to choke...Is there a way to use a relative path?

print "Location: index2.html\n\n"; ### try to do relative
print "Location: ./index2.html\n\n"; ### another attempt (1 dot)
print "Location: ../index2.html\n\n"; ### yet another attempt (2 dots)

(maybe if this won't work, someone could suggest another method to
accomplish same?)

Thanks much,

Colin








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

Date: Mon, 03 Jul 2000 19:26:36 GMT
From: nw23dh@my-deja.com
Subject: Re: redirection using Location: in Perl CGI script
Message-Id: <8jqpcr$kq$1@nnrp1.deja.com>

  "Colin Reinhardt" <colinrei@oz.net> wrote:

>
> The following works fine: (fully specified URL)
>
> print "Location: http://someserver/somepage/index2.html\n\n"; ###
Redirect
>
Here you're printing a whole url which your browser will interpret as a
link because it starts with "http://".

> but these other ways seem to choke...Is there a way to use a relative
path?
>
> print "Location: index2.html\n\n"; ### try to do relative
> print "Location: ./index2.html\n\n"; ### another attempt (1 dot)
> print "Location: ../index2.html\n\n"; ### yet another attempt (2 dots)
>
Here you are just typing some text, your browser has no way to know
that this is a file name.

You need to use an html tag like "Location: <a href=index2.html>name of
link</a>
to force the filename to treated as a link.

This is an HTML question not a perl question.  Read an HTML book.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 03 Jul 2000 16:05:31 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: redirection using Location: in Perl CGI script
Message-Id: <87aefyzzz8.fsf@limey.hpcc.uh.edu>

>> On Mon, 03 Jul 2000 19:26:36 GMT,
>> nw23dh@my-deja.com said:

>   "Colin Reinhardt" <colinrei@oz.net> wrote:
>>  The following works fine: (fully specified URL)
>> 
>> print "Location:
>> http://someserver/somepage/index2.html\n\n"; ###
> Redirect
>>
> Here you're printing a whole url which your browser will
> interpret as a link because it starts with "http://".

nope.  You are confusing HTML and HTTP.

>> but these other ways seem to choke...Is there a way to
>> use a relative
> path?
>>  print "Location: index2.html\n\n"; ### try to do
>> relative print "Location: ./index2.html\n\n"; ###
>> another attempt (1 dot) print "Location:
>> ../index2.html\n\n"; ### yet another attempt (2 dots)
>> 
> Here you are just typing some text, your browser has no
> way to know that this is a file name.

nope.  The client can have *no* reliable way of knowing
the underlying representation of a remote object.

> You need to use an html tag like "Location: <a
> href=index2.html>name of link</a> to force the filename
> to treated as a link.

nope.  You are confusing HTML and HTTP.

You didn't test this did you?  (Cardinal sin)

> This is an HTML question not a perl question.  Read an
> HTML book.

Use the CGI module's self_url() method to work out the
absolute URL referencing this program.  Then use
redirect() with the appropriate URL you constructed.

CGI.pm, q.v.

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Tue, 4 Jul 2000 00:09:25 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: redirection using Location: in Perl CGI script
Message-Id: <Pine.GHP.4.21.0007040004270.10577-100000@hpplus03.cern.ch>

On Mon, 3 Jul 2000 nw23dh@my-deja.com wrote:

>   "Colin Reinhardt" <colinrei@oz.net> wrote:

In fact, posted several times to at least two separate groups

> > print "Location: index2.html\n\n"; ### try to do relative
> > print "Location: ./index2.html\n\n"; ### another attempt (1 dot)
> > print "Location: ../index2.html\n\n"; ### yet another attempt (2 dots)
> >
> Here you are just typing some text, your browser has no way to know
> that this is a file name.

So you haven't much of a clue either.

I suppose neither of you considered reading the CGI spec?

> You need to use an html tag like "Location: <a href=index2.html>name of
> link</a>
> to force the filename to treated as a link.

Like Bu**ery you do.  Sheesh.

> This is an HTML question

Nope.  This is a CGI question.

> not a perl question. 

You got that right. 

Once again we see the inadvisability of offering off-topic answers.

f'ups redirected to the appropriate place, where I already posted
my answer to the same (multiposted) question.

Both scores adjusted accordingly.  Good luck.



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

Date: 3 Jul 2000 19:23:44 GMT
From: jhborwic@unity.ncsu.edu (John Harden Borwick)
Subject: Re: redirection using Location: in Perl CGI script
Message-Id: <8jqp80$37k$1@uni00nw.unity.ncsu.edu>

In article <sm1msb28op3168@corp.supernews.com>,
Colin Reinhardt <colinrei@oz.net> wrote:
>Can the Location: header attribute be used to redirect with a relative path?
>I haven't been able to get this to work.
>What I'm trying to do is redirect the user to another webpage in the same
>directory as the CGI script...
>
>The following works fine: (fully specified URL)
>
>print "Location: http://someserver/somepage/index2.html\n\n"; ### Redirect

Your question is less of a Perl question and more of a HTTP question, I
believe.  Nonetheless Perl has an answer...

From 'perldoc CGI':

       One hint I can offer is that relative links may not work
       correctly when you generate a redirection to another docu-
       ment on your site.  This is due to a well-intentioned
       optimization that some servers use.  The solution to this
       is to use the full URL (including the http: part) of the
       document you are redirecting to.

-- 
John Borwick


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

Date: Tue, 4 Jul 2000 02:36:10 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: redirection using Location: in Perl CGI script
Message-Id: <Pine.GHP.4.21.0007040223130.12223-100000@hpplus03.cern.ch>

On 3 Jul 2000, John Harden Borwick wrote:

>  Nonetheless Perl has an answer...

One which is unfortunately unsupported by the available interworking
specification.

> From 'perldoc CGI':

Documentation bug already reported...

>        One hint I can offer is that relative links may not work

There are two kinds of Location: CGI response codified in the CGI
specification.  Neither of them are relative links.

So indeed they "may not work", but that's because the spec doesn't
allow them.

>        correctly when you generate a redirection to another docu-
>        ment on your site.  This is due to a well-intentioned
>        optimization that some servers use. 

The behaviour in response to the two different kinds of Location: CGI
response is mandated by the specification.  No optimisation is
allowed.  But, as I say, neither kind is relative.

> The solution to this
>        is to use the full URL (including the http: part) of the
>        document you are redirecting to.

No.  Both kinds of CGI response codified in the specification are
valid and produce the different effects described in the
specification, on any conforming server.  Each of the two kinds of
response is useful in appropriate situations.

But _relative_ URLs, as opposed to absolute URLpaths, are invalid in a
CGI response. At any rate, this is clear from the draft RFC; the old
NCSA specification is a bit too vague to be unambiguously clear on
this point, and the Perl FAQ and CGI spec may well have been worded at
an earlier time when the situation was still indistinct.



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

Date: Tue, 04 Jul 2000 12:46:19 GMT
From: nw23dh@my-deja.com
Subject: Re: redirection using Location: in Perl CGI script
Message-Id: <8jsmao$ar1$1@nnrp1.deja.com>

In article <87aefyzzz8.fsf@limey.hpcc.uh.edu>,
  Tony Curtis <tony_curtis32@yahoo.com> wrote:
> >> On Mon, 03 Jul 2000 19:26:36 GMT,
> >> nw23dh@my-deja.com said:
>
> >   "Colin Reinhardt" <colinrei@oz.net> wrote:
> >>  The following works fine: (fully specified URL)
> >>
> >> print "Location:
> >> http://someserver/somepage/index2.html\n\n"; ###
> > Redirect
> >>
> > Here you're printing a whole url which your browser will
> > interpret as a link because it starts with "http://".
>
> nope.  You are confusing HTML and HTTP.
>

No actually I just didn't read the whole post.  I just assumed the
original poster was having trouble creating html links and posted a
quick solution.  If I'd bothered to read the whole post I would have
realised.

duly humbled. m:<
> >> but these other ways seem to choke...Is there a way to
> >> use a relative
> > path?
> >>  print "Location: index2.html\n\n"; ### try to do
> >> relative print "Location: ./index2.html\n\n"; ###
> >> another attempt (1 dot) print "Location:
> >> ../index2.html\n\n"; ### yet another attempt (2 dots)
> >>
> > Here you are just typing some text, your browser has no
> > way to know that this is a file name.
>
> nope.  The client can have *no* reliable way of knowing
> the underlying representation of a remote object.
>
> > You need to use an html tag like "Location: <a
> > href=index2.html>name of link</a> to force the filename
> > to treated as a link.
>
> nope.  You are confusing HTML and HTTP.
>
> You didn't test this did you?  (Cardinal sin)
>
> > This is an HTML question not a perl question.  Read an
> > HTML book.
>
> Use the CGI module's self_url() method to work out the
> absolute URL referencing this program.  Then use
> redirect() with the appropriate URL you constructed.
>
> CGI.pm, q.v.
>
> hth
> t
> --
> "With $10,000, we'd be millionaires!"
>                                            Homer Simpson
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 05 Jul 2000 15:00:17 GMT
From: newbie@db-networks.com
Subject: RegEx and numbers
Message-Id: <kui6mskkfll0mkguvdg6rfolmbqnrfukri@4ax.com>

I am trying to remove numbers.

If it is number or some characters have more than 3 digits then
replace it with blanks:
111111B2 ==> space
1.5b ==> space
2E3 ==> space
12 ==> space
N64 ==> keep
A7 ==> keep

$var =~ s/\d{3,}/ /g;          will do if there are more than 3
digits, but how to do the other ones?

Thanks


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

Date: 05 Jul 2000 12:01:58 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: RegEx and numbers
Message-Id: <slrn8m6o1b.ibb.abigail@alexandra.delanet.com>

newbie@db-networks.com (newbie@db-networks.com) wrote on MMD September
MCMXCIII in <URL:news:kui6mskkfll0mkguvdg6rfolmbqnrfukri@4ax.com>:
:) I am trying to remove numbers.
:) 
:) If it is number or some characters have more than 3 digits then
:) replace it with blanks:
:) 111111B2 ==> space
:) 1.5b ==> space
:) 2E3 ==> space
:) 12 ==> space
:) N64 ==> keep
:) A7 ==> keep

Your examples don't match your description. There are only 2 digits in
'1.5b', and '1.5b' isn't a number; at least not in Perl. 

The FAQ mentions regexes to decide when a string is a number, for various
interpretations of number - I will not repeat them. As for counting
characters, use tr///. See the perlop manpage.

:) $var =~ s/\d{3,}/ /g;          will do if there are more than 3
:) digits, but how to do the other ones?


No, that won't do. That will only replace the first set of 3 digits or
more (which aren't interrupted by other chars) with a space.

It'll replace '111111B2' with ' B2', while leaving '4N64' alone.


Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


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

Date: Wed, 05 Jul 2000 21:09:47 GMT
From: newbie@db-networks.com
Subject: Re: RegEx and numbers
Message-Id: <ln87msgig499jn6o20alue24bppb5lrl83@4ax.com>

On 05 Jul 2000 12:01:58 EDT, abigail@delanet.com (Abigail) wrote:

|  newbie@db-networks.com (newbie@db-networks.com) wrote on MMD September
|  MCMXCIII in <URL:news:kui6mskkfll0mkguvdg6rfolmbqnrfukri@4ax.com>:
|  :) I am trying to remove numbers.
|  :) 
|  :) If it is number or some characters have more than 3 digits then
|  :) replace it with blanks:
|  :) 111111B2 ==> space
|  :) 1.5b ==> space
|  :) 2E3 ==> space
|  :) 12 ==> space
|  :) N64 ==> keep
|  :) A7 ==> keep
|  
|  Your examples don't match your description. There are only 2 digits in
|  '1.5b', and '1.5b' isn't a number; at least not in Perl. 

Sorry, I did not explain myself well. They are two different problems:

As a string 1.5b is a number to me, so is 2E# and 12 and 111111B2. A
number is a string with numbers or a string with numbers and 1
character. 

A number is a string with numbers and 1 character at the most.  That's
what I cannot figure how to do in the regex.

|  
|  The FAQ mentions regexes to decide when a string is a number, for various
|  interpretations of number - I will not repeat them. As for counting
|  characters, use tr///. See the perlop manpage.
|  
|  :) $var =~ s/\d{3,}/ /g;          will do if there are more than 3
|  :) digits, but how to do the other ones?
|  
|  
|  No, that won't do. That will only replace the first set of 3 digits or
|  more (which aren't interrupted by other chars) with a space.
|  
|  It'll replace '111111B2' with ' B2', while leaving '4N64' alone.
|  
|  
|  Abigail



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

Date: Wed, 05 Jul 2000 17:37:52 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: RegEx and numbers
Message-Id: <3963AAB0.A06506D7@attglobal.net>

newbie@db-networks.com wrote:
> 
> As a string 1.5b is a number to me, so is 2E# and 12 and 111111B2. A
> number is a string with numbers or a string with numbers and 1
> character.
> 
> A number is a string with numbers and 1 character at the most.  That's
> what I cannot figure how to do in the regex.


These two statements conflict themselves.  First you say that 1.5b
is a number, but you also say that 2E# is a number. But then you 
say that a number is a string with numbers and 1 character at the 
most                                                       ^^^^^^
^^^^

But 2E# has 2 characters, if thats what you call #.  But since 
you are working with a vocabulary of your own creation, I cannot
be sure.  You may call # a 'thingy' or a 'doo-dad', and want to
allow doo-dads as part of a number.  

Long story short, no one can help you when you can't yourself 
define the problem.  Once the problem has been defined, the solution
is simple.  From perlre:

    \d  Match a digit character
    \D  Match a non-digit character

    *      Match 0 or more times
    +      Match 1 or more times
    ?      Match 1 or 0 times
    {n}    Match exactly n times
    {n,}   Match at least n times
    {n,m}  Match at least n but not more than m times

Using these is left as your excercise.


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

Date: 05 Jul 2000 19:10:17 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: RegEx and numbers
Message-Id: <slrn8m7h4d.ibb.abigail@alexandra.delanet.com>

newbie@db-networks.com (newbie@db-networks.com) wrote on MMD September
MCMXCIII in <URL:news:ln87msgig499jn6o20alue24bppb5lrl83@4ax.com>:
 .. On 05 Jul 2000 12:01:58 EDT, abigail@delanet.com (Abigail) wrote:
 .. 
 .. |  newbie@db-networks.com (newbie@db-networks.com) wrote on MMD September
 .. |  MCMXCIII in <URL:news:kui6mskkfll0mkguvdg6rfolmbqnrfukri@4ax.com>:
 .. |  :) I am trying to remove numbers.
 .. |  :) 
 .. |  :) If it is number or some characters have more than 3 digits then
 .. |  :) replace it with blanks:
 .. |  :) 111111B2 ==> space
 .. |  :) 1.5b ==> space
 .. |  :) 2E3 ==> space
 .. |  :) 12 ==> space
 .. |  :) N64 ==> keep
 .. |  :) A7 ==> keep
 .. |  
 .. |  Your examples don't match your description. There are only 2 digits in
 .. |  '1.5b', and '1.5b' isn't a number; at least not in Perl. 
 .. 
 .. Sorry, I did not explain myself well. They are two different problems:
 .. 
 .. As a string 1.5b is a number to me, so is 2E# and 12 and 111111B2. A
 .. number is a string with numbers or a string with numbers and 1
 .. character. 
 .. 
 .. A number is a string with numbers and 1 character at the most.  That's
 .. what I cannot figure how to do in the regex.

That still doesn't explain '1.5b' and '2E#', as both of them have
2 non-numbers.

Perhaps you should first make a sound definition. Once you have that, the
algorithm usually follows trivially.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Wed, 5 Jul 2000 19:27:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: RegEx and numbers
Message-Id: <slrn8m7h2v.i2u.tadmc@magna.metronet.com>

On Wed, 05 Jul 2000 21:09:47 GMT, newbie@db-networks.com <newbie@db-networks.com> wrote:
>On 05 Jul 2000 12:01:58 EDT, abigail@delanet.com (Abigail) wrote:
>
>|  newbie@db-networks.com (newbie@db-networks.com) wrote on MMD September
>|  MCMXCIII in <URL:news:kui6mskkfll0mkguvdg6rfolmbqnrfukri@4ax.com>:
>|  :) I am trying to remove numbers.
>|  :) 

>|  Your examples don't match your description. There are only 2 digits in
>|  '1.5b', and '1.5b' isn't a number; at least not in Perl. 
>
>Sorry, I did not explain myself well. They are two different problems:
>
>As a string 1.5b is a number to me, 
>so is 2E# and 12 and 111111B2. A
       ^^^


That has more than one non-digit char in it. '1.5b' also has
more than one non-digit.

So they are NOT "numbers"?


>number is a string with numbers or a string with numbers and 1
             ^^^^^^^^^^^^^^^^^^^
>character. 


You should be talking about _characters_ if you are doing
pattern matching.

  A number is a string with digit characters or a string with
  digit chars and 1 non-digit char.


>A number is a string with numbers and 1 character at the most.  That's
>what I cannot figure how to do in the regex.


If my rephrasing of what a Twilight Zone "number" is is correct,
then this ought to do it:

   if ( /^(\d+\D?\d*|\d*\D\d+)$/ )
      { print "'$_' is a number\n" }
   else
      { print "'$_' is NOT a number\n" }


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


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

Date: 05 Jul 2000 22:02:22 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: RegEx and numbers
Message-Id: <slrn8m7r72.ibb.abigail@alexandra.delanet.com>

Tad McClellan (tadmc@metronet.com) wrote on MMD September MCMXCIII in
<URL:news:slrn8m7h2v.i2u.tadmc@magna.metronet.com>:
!! 
!! If my rephrasing of what a Twilight Zone "number" is is correct,
!! then this ought to do it:
!! 
!!    if ( /^(\d+\D?\d*|\d*\D\d+)$/ )
!!       { print "'$_' is a number\n" }
!!    else
!!       { print "'$_' is NOT a number\n" }


Or just:

    if (tr/0-9// < -1 + length) {
        print "'$_' is NOT a number\n";
    }
    else {
        print "'$_' is a number\n";
    }


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Tue, 4 Jul 2000 12:17:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Regex replacing bits & pieces of a string in one shot... how?
Message-Id: <MPG.13cbd81927104c9898aba0@nntp.hpl.hp.com>

In article <slrn8l6d2g.fea.garcia_suarez@rafael.kazibao.net>, 
garcia_suarez@hotmail.com says...

 ...

> my %translate = (
>   A => 'string1',
>   B => 'string2',
>   C => 'string3',
> );
> $mystring =~ s/(A|B|C)/$translate{$1}/g;

When the lookup keys are all single characters, the regex performs 
better if written using a character class, rather than alternation.

  $mystring =~ s/([ABC])/$translate{$1}/g;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 6 Jul 2000 11:54:20 -0400
From: Matt <malenski@cse.buffalo.edu>
Subject: regular expressions
Message-Id: <Pine.GSO.3.96.1000706115244.8541F-100000@yeager.cse.Buffalo.EDU>



Quick question

Anyone know what %% means in the following:
$Description =~s/\r/%%/g;

Thanks,
-mm



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

Date: Thu, 06 Jul 2000 17:35:56 +0100
From: Ade Talabi <adetalabi@clara.co.uk>
Subject: Re: regular expressions
Message-Id: <3964B56C.1403FBB8@clara.co.uk>

Matt wrote:
> 
> Quick question
> 
> Anyone know what %% means in the following:
> $Description =~s/\r/%%/g;
> 
> Thanks,
> -mm
substitue /r with % globally


-- 
/--------------------------------------------------------------\
| Ade  Talabi     | Internet : adetalabi@clara.co.uk           |
|  ::M1ETW::      | Web Page : http://www.net-africa.com       |
\--------------------------------------------------------------/


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

Date: 06 Jul 2000 11:39:39 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: regular expressions
Message-Id: <871z17ciwk.fsf@limey.hpcc.uh.edu>

>> On Thu, 6 Jul 2000 11:54:20 -0400,
>> Matt <malenski@cse.buffalo.edu> said:

> Quick question

> Anyone know what %% means in the following: $Description
> =~s/\r/%%/g;

What happened when you tried it?  Isn't writing a 3 line
program to test it out, easier than posting world-wide to
USENET?

    $_ = "abcdef\r\r\rbbbb\r";
    s/\r/%%/g;
    print "$_\n";

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Thu, 6 Jul 2000 12:23:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regular expressions
Message-Id: <slrn8m9cjd.jc3.tadmc@magna.metronet.com>

On Thu, 6 Jul 2000 11:54:20 -0400, Matt <malenski@cse.buffalo.edu> wrote:


>Anyone know what %% means in the following:
>$Description =~s/\r/%%/g;


It means %%  (two percent characters).


And your Subject is very misleading because your question
is not about regular expressions at all!

Your question is about replacment _strings_.

perlop says:

   =item s/PATTERN/REPLACEMENT/egimosx

the

   \r

part is a regular expression (pattern).

the

   %%
   
part is a replacement string (and % chars are not special in strings).


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


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

Date: Thu, 6 Jul 2000 14:01:36 -0400
From: Matt <malenski@cse.buffalo.edu>
Subject: Re: regular expressions
Message-Id: <Pine.GSO.3.96.1000706140113.7602A-100000@yeager.cse.Buffalo.EDU>


Thanks for the insight.
-mm

On Thu, 6 Jul 2000, Tad McClellan wrote:

> On Thu, 6 Jul 2000 11:54:20 -0400, Matt <malenski@cse.buffalo.edu> wrote:
> 
> 
> >Anyone know what %% means in the following:
> >$Description =~s/\r/%%/g;
> 
> 
> It means %%  (two percent characters).
> 
> 
> And your Subject is very misleading because your question
> is not about regular expressions at all!
> 
> Your question is about replacment _strings_.
> 
> perlop says:
> 
>    =item s/PATTERN/REPLACEMENT/egimosx
> 
> the
> 
>    \r
> 
> part is a regular expression (pattern).
> 
> the
> 
>    %%
>    
> part is a replacement string (and % chars are not special in strings).
> 
> 
> -- 
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas
> 
> 



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

Date: Thu, 06 Jul 2000 12:37:09 -0700
From: Bacbalabby <user@host.com>
Subject: Re: regular expressions
Message-Id: <3964DFE5.A4AD9859@host.com>

Ignore them. I guarantee you're going to lead an infinitely more successful
life than this person or any of the other emotionally unstable wannabe gurus
here.

Matt wrote:

> Thanks for the insight.
> -mm
>
> On Thu, 6 Jul 2000, Tad McClellan wrote:
>
> > On Thu, 6 Jul 2000 11:54:20 -0400, Matt <malenski@cse.buffalo.edu> wrote:
> >
> >
> > >Anyone know what %% means in the following:
> > >$Description =~s/\r/%%/g;
> >
> >
> > It means %%  (two percent characters).
> >
> >
> > And your Subject is very misleading because your question
> > is not about regular expressions at all!
> >
> > Your question is about replacment _strings_.
> >
> > perlop says:
> >
> >    =item s/PATTERN/REPLACEMENT/egimosx
> >
> > the
> >
> >    \r
> >
> > part is a regular expression (pattern).
> >
> > the
> >
> >    %%
> >
> > part is a replacement string (and % chars are not special in strings).
> >
> >
> > --
> >     Tad McClellan                          SGML Consulting
> >     tadmc@metronet.com                     Perl programming
> >     Fort Worth, Texas
> >
> >



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

Date: Thu, 06 Jul 2000 19:45:22 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regular expressions
Message-Id: <x7bt0bqbzj.fsf@home.sysarch.com>

>>>>> "B" == Bacbalabby  <user@host.com> writes:

  B> Ignore them. I guarantee you're going to lead an infinitely more
  B> successful life than this person or any of the other emotionally
  B> unstable wannabe gurus here.

then why are you here? to lord over all of us with you superior
emotional skills and inferior usenet and perl abilities? well, that
won't cut it at all. you have shown much worse social skills than anyone
else in the threads you are in. you show no usenet skills (jeopardy
quoting, no editong of quotes, no comments on topic, etc.) and obviously
know nothing about perl. so shut up and lurk for a while until you grow
up a little. like maybe a few decades.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 06 Jul 2000 19:47:11 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: regular expressions
Message-Id: <7aya3fujku.fsf@merlin.hyperchip.com>


Ade Talabi <adetalabi@clara.co.uk> writes:

> Matt wrote:
> > 
> > Quick question
> > 
> > Anyone know what %% means in the following:
> > $Description =~s/\r/%%/g;
> > 
> > Thanks,
> > -mm
> substitue /r with % globally

No. Substitute \r (not /r) with %% (not %) globally.

Checkout perlre for more info.

--Ala


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

Date: Thu, 06 Jul 2000 13:09:05 -0700
From: Bacbalabby <user@host.com>
Subject: Re: regular expressions
Message-Id: <3964E760.903B6C35@host.com>



Uri Guttman wrote:

> >>>>> "B" == Bacbalabby  <user@host.com> writes:
>
>   B> Ignore them. I guarantee you're going to lead an infinitely more
>   B> successful life than this person or any of the other emotionally
>   B> unstable wannabe gurus here.
>
> then why are you here?

Why not, I posted a question earlier today and am waiting for the answer, which
I just got.  And now I can leave(hooray!).  Feel free to keep replying to this
thread as often as you like after I leave(cuz I know you all will).



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

Date: Thu, 6 Jul 2000 13:05:07 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: regular expressions
Message-Id: <MPG.13ce864d7571492a98abb1@nntp.hpl.hp.com>

[Rearranged to provide a semblance of logical flow in the sequential 
posts.]

In article <3964DFE5.A4AD9859@host.com> on Thu, 06 Jul 2000 12:37:09 -
0700, Bacbalabby <user@host.com> says...
> Matt wrote:
> > On Thu, 6 Jul 2000, Tad McClellan wrote:
> > > On Thu, 6 Jul 2000 11:54:20 -0400, Matt <malenski@cse.buffalo.edu> wrote:
> > >
> > > >Anyone know what %% means in the following:
> > > >$Description =~s/\r/%%/g;
> > >
> > > It means %%  (two percent characters).

 ...

> > Thanks for the insight.
> > -mm
>
> Ignore them. I guarantee you're going to lead an infinitely more successful
> life than this person or any of the other emotionally unstable wannabe gurus
> here.

Consider what you have done in this newsgroup:

In another thread, you persistently disregard the requests to provide 
diagnostic information, and petulantly insist that "unlink doesn't work 
on Windows98" despite everyone's assurance that it does.

Now you interject yourself into this thread and choose to interpret a 
gracious thank-you in acknowledgment of a useful and correct answer as 
sarcastic, thereby twisting Matt's appreciation into your own 
resentment.

Why do you expect people here to concern themselves with helping you, in 
the face of your gratuitous hostility?  I think a sincere apology is 
warranted, lest you never receive any responses to your posts in the 
future.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 06 Jul 2000 18:19:08 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: regular expressions
Message-Id: <slrn8ma2gg.mjo.abigail@alexandra.delanet.com>

Matt (malenski@cse.buffalo.edu) wrote on MMDI September MCMXCIII in
<URL:news:Pine.GSO.3.96.1000706115244.8541F-100000@yeager.cse.Buffalo.EDU>:
|| 
|| Anyone know what %% means in the following:
|| $Description =~s/\r/%%/g;

It's a string of two characters, of which the first is a `%', and
the last is a `%' as well. With nothing in between.

What do _you_ think it means?


Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: 06 Jul 2000 18:20:11 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: regular expressions
Message-Id: <slrn8ma2if.mjo.abigail@alexandra.delanet.com>

Ala Qumsieh (aqumsieh@hyperchip.com) wrote on MMDI September MCMXCIII in
<URL:news:7aya3fujku.fsf@merlin.hyperchip.com>:
$$ 
$$ Ade Talabi <adetalabi@clara.co.uk> writes:
$$ 
$$ > Matt wrote:
$$ > > 
$$ > > Quick question
$$ > > 
$$ > > Anyone know what %% means in the following:
$$ > > $Description =~s/\r/%%/g;
$$ > > 
$$ > > Thanks,
$$ > > -mm
$$ > substitue /r with % globally
$$ 
$$ No. Substitute \r (not /r) with %% (not %) globally.


Eh, no. That is what the entire thing means, but the question was what
%% means.



Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3595
**************************************


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