[10393] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3986 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 15 18:27:18 1998

Date: Thu, 15 Oct 98 15:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 Oct 1998     Volume: 8 Number: 3986

Today's topics:
    Re: a camel? (Adam Turoff)
    Re: Activestate != standard distribution? [Was Re: Win3 (Jan Dubois)
        Combining two @array's al.woods@pbi.ab.ca
    Re: Combining two @array's <ajohnson@gatewest.net>
    Re: Combining two @array's <rootbeer@teleport.com>
        database, need perl and cgi? <u6el@csc.liv.ac.uk>
        Net::SMTP crashes when used with Thread <mcariaso@genelogic.com>
        Odd error message with ActivePerl on Windows NT <webevent@MatadorDesign.com>
    Re: PERl and HTACCESS authentication <rootbeer@teleport.com>
    Re: Perl FAQ - error found in "#How_do_I_get_a_file_s_t <ludlow@us.ibm.com>
    Re: posix test fails: Perl 5.005_02, MSWin32-x86 (Jan Dubois)
        Pushing onto multi-dimensioned arrays <sherlock@genome.stanford.edu>
    Re: Pushing onto multi-dimensioned arrays (Matt Knecht)
    Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has regi (Adam Turoff)
    Re: Sorry (Adam Turoff)
    Re: The space deletion woes... <eashton@bbnplanet.com>
    Re: The space deletion woes... (Larry Rosler)
    Re: The space deletion woes... <ajohnson@gatewest.net>
    Re: The space deletion woes... (Mark D.)
    Re: The space deletion woes... <uri@camel.fastserv.com>
    Re: The space deletion woes... <uri@camel.fastserv.com>
    Re: The space deletion woes... <eashton@bbnplanet.com>
    Re: The space deletion woes... <eashton@bbnplanet.com>
    Re: The space deletion woes... <uri@camel.fastserv.com>
    Re: The space deletion woes... <eashton@bbnplanet.com>
    Re: The space deletion woes... <uri@camel.fastserv.com>
    Re: The space deletion woes... (Larry Rosler)
    Re: The space deletion woes... <uri@camel.fastserv.com>
    Re: The space deletion woes... (Larry Rosler)
    Re: The space deletion woes... <eashton@bbnplanet.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 15 Oct 1998 17:58:17 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: a camel?
Message-Id: <705r5p$39r@panix.com>

John Porter  <jdporter@min.net> wrote:
>Ed wrote:
>> 
>> Why are there camels on so many perl pages, and on my O'Rielly book. I
>> would consider a mollusk like an Oyster to have more relevance.
>
>What the history pages don't mention is that Larry originally
>called the language "Camel", but had to change it when he found
>out there was already another language named CAML.

Methinks you forgot the bit where he wanted a name that had four characters
instead of five.  When 'camel' became 'caml', Larry had the problem 
of conflicting with CAML, so he thought of calling the language 
the 'new_caml', but that was longer than 4 chars.

Then he was thinking of what to call a 'well rounded language'.  
So he started calling it pe[a]rl, since a how much more rounded can a
pearl be?  None.  None more round.  :-) :-)

Z.



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

Date: Thu, 15 Oct 1998 22:59:25 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Activestate != standard distribution? [Was Re: Win32 Net::FTP trouble]
Message-Id: <362d60c7.10935814@news3.ibm.net>

[mailed & posted]

wdr1@pobox.com (William D. Reardon) wrote:

>In article <01bdf707$bad38ce0$77ea1286@steelres-pcm657.resmel.bhp.com.au>,
>Ron Savage <Savage.Ron.RS@bhp.com.au> wrote:
>>ActiveState Perl V 5.005.02 has bugs in it which are not in the standard
>>distribution. These bugs stop Net::FTP from working. Delete ActiveState
>>Perl & install the standard distribution >:(.
>
>	I'm confused - as a result of the "one Perl" effort, isn't the
>ActiveState port & the standard distribution one and the same?

In principle: Yes. But the current build 504 contains additional patches
over the last stable distribution. If the problems are a result of these
additional patches is not known to me.

It is my understanding that all locally applied patches from ActiveState
have been submitted to perl5-porters and will also show up in 5.005_03.

-Jan


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

Date: Thu, 15 Oct 1998 21:11:05 GMT
From: al.woods@pbi.ab.ca
Subject: Combining two @array's
Message-Id: <705od9$td3$1@nnrp1.dejanews.com>

Afternoon,

I'm probably looking for a complex solution where a simple one is available
but is there an easy way to combine 2 @array's?

Thanks in advance,

al...

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 15 Oct 1998 16:36:06 -0500
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: Combining two @array's
Message-Id: <36266AC6.526DEC20@gatewest.net>

al.woods@pbi.ab.ca wrote:
!
! Afternoon,
! 
! I'm probably looking for a complex solution where a simple one is available
! but is there an easy way to combine 2 @array's?
! 
! Thanks in advance,

did you mean 'combine' in any special way? or simply:
 
@array_1 = qw/a b c d e f g/;
@array_2 = (1,2,3,4,5,6,7);
@combined = (@array_1,@array_2);
print "@combined\n";

regards
andrew


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

Date: Thu, 15 Oct 1998 21:35:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Combining two @array's
Message-Id: <Pine.GSO.4.02A.9810151434040.26848-100000@user2.teleport.com>

On Thu, 15 Oct 1998 al.woods@pbi.ab.ca wrote:

> I'm probably looking for a complex solution where a simple one is
> available but is there an easy way to combine 2 @array's?

    @one = qw{ Yes it is possible };
    @two = qw{ for some definition of "combine". };
    @both = (@one, @two);
    print "@both\n";

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 15 Oct 1998 15:54:38 GMT
From: Elly <u6el@csc.liv.ac.uk>
Subject: database, need perl and cgi?
Message-Id: <36261ABE.5468@csc.liv.ac.uk>

I wonder if anyone can help me...i am doing a project and I am having
some
problems.

the project is for an online questionaire..at the moment the
questionaire is in
HTNL...and the information from the questionaire will be inputted into a
database, I am thinking of using Access to creat the database, but do I
need
Perl program and CGI script??? what does perl do? so do i need, CGI,
Perl amd
Access to do it? what if I want to retrievel information from teh
database....what do I use to do that?

can you email me if you can help..I am totally confused.

:-(
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Elvina Lam
   Department of Computer Science,
   University of Liverpool
   http://www.csc.liv.ac.uk/~u6el
   u6el@csc.liv.ac.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Thu, 15 Oct 1998 21:35:40 GMT
From: Mike Cariaso <mcariaso@genelogic.com>
Subject: Net::SMTP crashes when used with Thread
Message-Id: <36266A9E.5195C664@genelogic.com>

The following script crashes for me under 2 platforms
irix 6.3 with perl5.0 patchlevel 5 subversion 2 usethreads=define
and 
linux 2.0.32 i586 with perl5.0 patchlevel 5 subversion 1 usethreads=define


The mailsub subroutine runs just fine when called directly, but
The Net::SMTP->new seems to be very unhappy when called from a thread.
Suggestions for work arounds would be greatly appreciated.

**be sure to customize 'email' to the name of your mailserver.

use Thread;
use Net::SMTP;

sub mailsub {
    my $smtp;
    print "1\n";
    $smtp = Net::SMTP->new('email');
    print "2\n";
    print $smtp->domain(),"\n";
    print "3\n";
}

mailsub;
print "=========\n";
new Thread \&mailsub;



if no work arounds seem possible (practical?) what other methods might be used.
I will only have a single thread sending mail, but threads are so fundamental to
the app's architecture that they can't be avoided.



-- 
Mike Cariaso                     (301) 987-1834
Software Engineer        mcariaso@genelogic.com         
Gene Logic, Inc.       http://www.genelogic.com


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

Date: 15 Oct 1998 15:47:08 -0600
From: WebEvent <webevent@MatadorDesign.com>
Subject: Odd error message with ActivePerl on Windows NT
Message-Id: <y3gbtndfqg3.fsf@net.indra.com>


Hi,

We have a client who, despite all of our remote hand holding, has been
unable to get ActivePerl (or Perl for Win32) to work with IIS3.0
(system NT 4.0 Opt 3.0).  Currently, after fresh installs, every perl
script returns the following error message:

CGI Error
The specified CGI application misbehaved by not returning a complete
set
of HTTP headers. The headers it did return are: 
Can't open perl script "??????????????????l???????????????????f":
Invalid argument

The scripts run as expected from within Windows NT.  The registry
entry is supposedly correct:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Sc
ript Map

c:\Perl\5.00502\bin\MSWin32-x86-object\perl.exe %s %s

Any suggestions?

-James Cameron  
Matador Design, Inc.
http://www.MatadorDesign.com



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

Date: Thu, 15 Oct 1998 21:32:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: PERl and HTACCESS authentication
Message-Id: <Pine.GSO.4.02A.9810151428110.26848-100000@user2.teleport.com>

On Thu, 15 Oct 1998, Stewart Eastham wrote:

> I have already checked the FAQs.  In fact where I got the sample code
> I used was from Nick Kew's "Login On the Web" tutorial.  But, again,
> using the code I found in that document, I still can't get it to work
> properly.

> As I said, I have already scoured the FAQs for info regarding PERL,
> CGI, and HTACCESS.

What I told you before was "If you're trying to get a browser to do
something, the docs, FAQs, and newsgroups about browsers should be
helpful." Have you checked any docs, FAQs, and newsgroups about
_browsers_? 

If you're following the proper protocol but some browser or server doesn't
cooperate, then it's the other program's fault. If you're not following
the protocol, then it's your fault. If you aren't sure about the protocol,
you should read the protocol specification. If you've read it and you're
still not sure, you should ask in a newsgroup about the protocol.

This newsgroup is about Perl. It's not about browsers, servers, or
protocols. 

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 15 Oct 1998 16:50:11 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Perl FAQ - error found in "#How_do_I_get_a_file_s_timestamp_"
Message-Id: <36266E13.A861C9E9@us.ibm.com>

Daniel Grisinger wrote:

> So create a patch and send it to Tom.  You obviously know the
> solution, fix it.
> 
> dgris
> - Amazed at the fact that so many people use free software
> but still don't get it.

Really?  I get free software all the time. :P

What I failed to ask was whether or not the error was fixed in a more
recent version of the Perl distribution.  This has already been answered
in another post.  It has been fixed.  A patch would be pointless.

In hindsight, I should have just emailed it to Tom.  However, I don't
see how pointing out an error in the documentation is somehow a sign of
not "getting" free software.

If I didn't "get" free software, I'd be demanding that the error be
fixed.  And I'd probably be _amazed_ that the copy of the FAQ online
isn't in synch with the copy in distribution.

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Thu, 15 Oct 1998 22:59:23 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: posix test fails: Perl 5.005_02, MSWin32-x86
Message-Id: <362c5bc3.9651878@news3.ibm.net>

[mailed & posted]

sztaylor@alaska.net (Simon Taylor) wrote:

>I'm still looking into the failure of op/stat.t if anybody has any
>ideas!

It would help if you were telling which op/stat.t test failed. The one that
fails consistently when running in an Emacs shell on WinNT is (I think) #39.
This is normal, because in this case stdin is not a tty (and NT doesn't have
pttys). If you are running on a non-tty type shell/console, you can try
"nmake test-notty" which skips tests #36 to #39.

-Jan


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

Date: Thu, 15 Oct 1998 14:07:05 -0700
From: Gavin Sherlock <sherlock@genome.stanford.edu>
Subject: Pushing onto multi-dimensioned arrays
Message-Id: <362663F9.F961551A@genome.stanford.edu>

Hi all,
	I have an array which has two dimensions.  Say I have an element

$array[0][0].  I want to push the contents of a variable so that the
reference to where that variable's contents have gone is now
$array[0][1],  and next time I push the contents will go to $array[0][2]
and so on.  The first number is actually variable defined, so my code
looks something like this:

push($array[$number], $a);

which doesn't work. (it says it expects me to push an array, but I only
want to push an element of the array)

I've tried various things, all to no avail, and was wondering if anyone
could help me.  Reading the lists of lists section in the manpages was
not able to enlighten me either,
Cheers,

Gavin Sherlock
Dept. of Genetics
Stanford University
300 Pasteur Drive

Tel: 650 498 6602


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

Date: Thu, 15 Oct 1998 21:18:49 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Pushing onto multi-dimensioned arrays
Message-Id: <ZEtV1.8947$wV1.5991510@news2.voicenet.com>

Gavin Sherlock <sherlock@genome.stanford.edu> wrote:
>push($array[$number], $a);

push @{$array[$number]}, $a;

push takes an array as it's first argument, not a reference to an array.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: 15 Oct 1998 17:50:48 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <705qno$2a2@panix.com>

Elaine -HappyFunBall- Ashton  <eashton@bbnplanet.com> wrote:
>/me wonders what a 'camel pub' would be like....hmmmmm.

A rundown dive bar in San Jose just off the main drag.  What did you think 
it would be like?  

Z.



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

Date: 15 Oct 1998 17:42:44 -0400
From: ziggy@panix.com (Adam Turoff)
Subject: Re: Sorry
Message-Id: <705q8k$1jb@panix.com>

In article <362627ED.C42390AC@min.net>, John Porter  <jdporter@min.net> wrote:
>Larry Wall wrote:
>> 
>> Perl is worse than Python because people wanted it worse.
>
>Meaning "wanted it more badly", I take it?

Not necessarily.  Larry's statement works on both levels.

People found it useful to have s/foo/bar/; in the middle of a line
rather than using regsub('foo', 'bar').  The first line always looks
intuitive to a regex jockey.  

At least that's my reading...

Z.



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

Date: Thu, 15 Oct 1998 21:04:53 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: The space deletion woes...
Message-Id: <362660F4.6EA48B1C@bbnplanet.com>

Mark D. wrote:

> $cgi_client{'upfile'} =~ s/^\s+//;

This says to match one or more spaces at the beginning of the line.
Obviously that one worked looking at your result.

> $cgi_client{'upfile'} =~ s/\s+$//;

This says to match one or more spaces through the end of the line.

> $cgi_client{'upfile'} =~ s/\s+/ /g;;

This says to match one or more spaces and replace with one or two (can't
tell). This one makes no sense really in context of the above...at least
to me, then again I have no idea what you are trying to do here.

=~ s/\s+?//g;

This should do the trick for the top two. Uri and Larry I'm sure will
correct me if I'm wrong here, but I did test it on a little snippet.

e.

After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia.  - U. Eco -


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

Date: Thu, 15 Oct 1998 14:22:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: The space deletion woes...
Message-Id: <MPG.1090074f2b402342989813@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <362660F4.6EA48B1C@bbnplanet.com> on Thu, 15 Oct 1998 
21:04:53 GMT, Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> 
says...
 ...
> =~ s/\s+?//g;
> 
> This should do the trick for the top two. Uri and Larry I'm sure will
> correct me if I'm wrong here, but I did test it on a little snippet.

You're correct, *but* with the 'g' at the end the '+' is meaningless.  
Instead of grabbing and deleting each hunk of space, you're doing it one 
space character at a time.  Obviously that is slower.

#!/usr/local/bin/perl -w
use Benchmark;

$x = '  Here    goes     nothing one space now ';

timethese (1 << (shift || 0), {
  All => sub { $_ = $x;  s/\s+//g },
  One => sub { $_ = $x;  s/\s+?//g },
} );

Benchmark: timing 65536 iterations of All, One...
       All:  3 wallclock secs ( 3.69 usr +  0.00 sys =  3.69 CPU)
       One:  5 wallclock secs ( 5.20 usr +  0.00 sys =  5.20 CPU)

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


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

Date: Thu, 15 Oct 1998 16:32:08 -0500
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: The space deletion woes...
Message-Id: <362669D8.120D648B@gatewest.net>

Mark D. wrote:
!
! Hi;
! 
! I'm a total newbie, read the faq, looked everywhere, still can't seem
! to figure this out. Might someone be so kind as to point out the
! error of my ways? It's pretty simple, I think.
! 
! The following code is supposed to delete any and all spaces from a
! string, but what i winds up doing is just deleting the first spaces
! from the first two words, like:
! 
! Here    goes     nothing one space now
! 
! becomes
! 
! Heregoes     nothing one space now
! 
! My code is this:
! 
! $cgi_client{'upfile'} =~ s/^\s+//;
! $cgi_client{'upfile'} =~ s/\s+$//;
! $cgi_client{'upfile'} =~ s/\s+/ /g;;
! 
! I'm tearing all my hair out, can some pa-lease help?

I can't duplicate your problem, are you sure that's the code
you really used? (perhaps in your real code, you neglected to
put the ^ in the first regex? that might account for part of the
problem):

#!/usr/bin/perl -w
$_="Here   goes   nothing one space now  ";
s/^\s+//;   # strip leading whitespace
s/\s+$//;   # string trailing whitespace
s/\s+/ /g;  # replace multi-whitespace with single spaces, globally
print "|$_|\n";
__END__

this prints:
|Here goes nothing one space now|
on my machine.

If you wanted to 'delete any an all spaces' perhaps you wanted:

$_="Here   goes   nothing one space now  ";
tr/\t //d;
print "|$_|\n";

(also removes tabs, just in case)

regards
andrew


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

Date: Thu, 15 Oct 1998 21:25:15 GMT
From: mark@doddx.com (Mark D.)
Subject: Re: The space deletion woes...
Message-Id: <362967f0.66382081@news.supernews.com>

Hmmm... follow up:

$cgi_client{'upfile'} =~ s/\s+//;

or 

$cgi_client{'upfile'} =~ s/ +//;

or

or $cgi_client{'upfile'} =~ s/ +//g;

in place or my previous flawed statement returns the same result. 

Anyone?




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

Date: 15 Oct 1998 17:31:40 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: The space deletion woes...
Message-Id: <sarogrdpl4z.fsf@camel.fastserv.com>

>>>>> "MD" == Mark D <mark@doddx.com> writes:

  MD> Hi;
  MD> I'm a total newbie, read the faq, looked everywhere, still can't seem
  MD> to figure this out. Might someone be so kind as to point out the error
  MD> of my ways? It's pretty simple, I think.
  MD> The following code is supposed to delete any and all spaces from a
  MD> string, but what i winds up doing is just deleting the first spaces
  MD> from the first two words, like:

  MD> Here    goes     nothing one space now

  MD> becomes 

  MD> Heregoes     nothing one space now

well i tried your code and it removes extra blanks like it should. it
does not do what you show here. are you sure you ran the code below on
this string? maybe the string was different or the code was slightly
different?

also what do you mean by this:

  MD> The following code is supposed to delete any and all spaces from a

the code below doesn't do that. do you want to delete ALL spaces or just
extra spaces?

  MD> $cgi_client{'upfile'} =~ s/^\s+//;
only deletes leading spaces

  MD> $cgi_client{'upfile'} =~ s/\s+$//;
only deletes trailing spaces

  MD> $cgi_client{'upfile'} =~ s/\s+/ /g;;
only converts multiple spaces to single spaces and globally

  MD> I'm tearing all my hair out, can some pa-lease help?

we could start a wig company?

  MD> (remove the x from my email if your reply is sent that way!)

no, it won't be mailed since you didn't despam your address.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: 15 Oct 1998 17:34:50 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: lr@hpl.hp.com (Larry Rosler)
Subject: Re: The space deletion woes...
Message-Id: <sarn26xpkzp.fsf@camel.fastserv.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> 21:04:53 GMT, Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> 
  LR> says...
  LR> ...
  >> =~ s/\s+?//g;
  >> 
  >> This should do the trick for the top two. Uri and Larry I'm sure will
  >> correct me if I'm wrong here, but I did test it on a little snippet.

  LR> You're correct, *but* with the 'g' at the end the '+' is meaningless.  
                                                         ^
larry,

did you mean '?' ? the + is meaningful to get multiple spaces

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 15 Oct 1998 21:37:30 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: The space deletion woes...
Message-Id: <36266897.EE2EC3EF@bbnplanet.com>

Larry Rosler wrote:

> You're correct, *but* with the 'g' at the end the '+' is meaningless.
> Instead of grabbing and deleting each hunk of space, you're doing it one
> space character at a time.  Obviously that is slower.

Cool Larry. :) Thanks. Regex isn't my best forte', but this I should
have seen. Impressive that it is so much less efficient. 

e.

After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia.  - U. Eco -


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

Date: Thu, 15 Oct 1998 21:39:26 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: The space deletion woes...
Message-Id: <3626690B.3038EDD1@bbnplanet.com>

Uri Guttman wrote:

>   MD> I'm tearing all my hair out, can some pa-lease help?
> 
> we could start a wig company?

Well, Uri pulled his hair out long ago from regex. He's BALD!!! 

/me flees *mwaahaahaah*

e.

After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia.  - U. Eco -


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

Date: 15 Oct 1998 17:39:38 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: The space deletion woes...
Message-Id: <sark921pkrp.fsf@camel.fastserv.com>

>>>>> "MD" == Mark D <mark@doddx.com> writes:

  MD> Hmmm... follow up:
  MD> $cgi_client{'upfile'} =~ s/\s+//;

\s is any whitespace char (blank, tab, newline, return, formfeed)

  MD> $cgi_client{'upfile'} =~ s/ +//;

so this is the same as above with only blank. given your input the
output would be the same

and both will only delete the first whitespace or blank string it finds

  MD> or $cgi_client{'upfile'} =~ s/ +//g;

this should delete ALL blanks in your string. this is NOT the same as above.

  MD> in place or my previous flawed statement returns the same result. 

so what is the question or problem? you seem to have code to do the
various blank deletions you want. maybe you should be clearer about your
goals here.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 15 Oct 1998 21:41:40 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: The space deletion woes...
Message-Id: <36266991.C0127ED2@bbnplanet.com>

Uri Guttman wrote:

> did you mean '?' ? the + is meaningful to get multiple spaces

Yeah, he meant '?'. Dunno why I tossed it in there as my test didn't
have it. Cool benchmark. 

e.

After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia.  - U. Eco -


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

Date: 15 Oct 1998 17:42:09 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: The space deletion woes...
Message-Id: <sariuhlpkni.fsf@camel.fastserv.com>

>>>>> "E-A" == Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> writes:

  E-A> Uri Guttman wrote:
  MD> I'm tearing all my hair out, can some pa-lease help?
  >> 
  >> we could start a wig company?

  E-A> Well, Uri pulled his hair out long ago from regex. He's BALD!!! 

  E-A> /me flees *mwaahaahaah*

you fleas! (from your overgrown mutt :-)

and it is receding nicely, thank you. but i will never take what is left
and comb it around my head.

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 15 Oct 1998 14:40:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: The space deletion woes...
Message-Id: <MPG.10900bb952355a0a989815@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <sarn26xpkzp.fsf@camel.fastserv.com> on 15 Oct 1998 17:34:50 
-0400, Uri Guttman <uri@camel.fastserv.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
 ...
>   >> =~ s/\s+?//g;
 ...
>   LR> You're correct, *but* with the 'g' at the end the '+' is meaningless.  
>                                                          ^
> larry,
> 
> did you mean '?' ? the + is meaningful to get multiple spaces

Of course.  Brain/finger slip.  And I *did* test the code (and posted 
the Benchmark to prove it :-).

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


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

Date: 15 Oct 1998 17:44:44 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: The space deletion woes...
Message-Id: <sarhfx5pkj7.fsf@camel.fastserv.com>

>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:

  LR> [Posted to comp.lang.perl.misc and a copy mailed.]
  LR> In article <sarn26xpkzp.fsf@camel.fastserv.com> on 15 Oct 1998 17:34:50 
  LR> -0400, Uri Guttman <uri@camel.fastserv.com> says...
  >> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
  LR> ...
  >> >> =~ s/\s+?//g;
  LR> ...
  LR> You're correct, *but* with the 'g' at the end the '+' is meaningless.  
  >> ^
  >> larry,
  >> 
  >> did you mean '?' ? the + is meaningful to get multiple spaces

  LR> Of course.  Brain/finger slip.  And I *did* test the code (and posted 
  LR> the Benchmark to prove it :-).

you should get a new thinking wig from the hair of the original poster!
it helps to keep the fingers from slipping from the head.

:-)

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Thu, 15 Oct 1998 14:43:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: The space deletion woes...
Message-Id: <MPG.10900c5235daab40989817@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <36275a4b.62888865@news.supernews.com> on Thu, 15 Oct 1998 
20:33:20 GMT, Mark D. <mark@doddx.com> says...
 ...
> The following code is supposed to delete any and all spaces from a
> string, but what i winds up doing is just deleting the first spaces
> from the first two words, like:
> 
> Here    goes     nothing one space now
> 
> becomes 
> 
> Heregoes     nothing one space now
> 
> My code is this:
> 
> $cgi_client{'upfile'} =~ s/^\s+//;
> $cgi_client{'upfile'} =~ s/\s+$//;
> $cgi_client{'upfile'} =~ s/\s+/ /g;;
> 
> I'm tearing all my hair out, can some pa-lease help?

Leave some for the barber to deal with!

Your code says: delete leading spaces; delete trailing spaces; replace 
any sequence of spaces by a single space.

If you want to do what you say, you can replace all of that by

  $cgi_client{'upfile'} =~ s/\s+//g;

as shown in another response.

If by 'space' you mean 'the space character', then this is faster:

  $cgi_client{'upfile'} =~ tr/ //d;

I assume the second semicolon on your last statement is out of 
frustration... :-)

All this should be found in `perldoc perlre` or (perhaps easier), 
'Learning Perl'.

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


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

Date: Thu, 15 Oct 1998 21:53:34 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: The space deletion woes...
Message-Id: <36266C5B.F1ADC7DD@bbnplanet.com>

Uri Guttman wrote:

>   E-A> /me flees *mwaahaahaah*
> 
> you fleas! (from your overgrown mutt :-)

Donut Taunt HFB!!! ;) He is smelly but has no freas [sic].

> and it is receding nicely, thank you. but i will never take what is left
> and comb it around my head.

Oh hey, nothing sexier than a slickster combover...some unctuous dude
with said sexiness tried to schmooze me at the Burren the other night.
An ex-olympic skater who now makes sports shirts for a living. Receding
is fine, the sculpted 'dry-look' just makes people want to laugh...esp.
in a high wind or after a few beers. *giggle*

e.

After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia.  - U. Eco -


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 3986
**************************************

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