[11594] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5194 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 21 22:07:20 1999

Date: Sun, 21 Mar 99 19:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 21 Mar 1999     Volume: 8 Number: 5194

Today's topics:
    Re: Can't read a text file with weird characters in it. <rick.delaney@home.com>
    Re: Can't read a text file with weird characters in it. (M.J.T. Guy)
    Re: Converting an unsigned 16 bit integer to decimal ?? <walton@frontiernet.net>
    Re: CPAN (Sam Holden)
    Re: Forwarding to home directory using Net::FTP <rmcvay@acm.org>
        Help Needed Please!!! <support@onlineauctions.co.uk>
    Re: Help Needed Please!!! <walton@frontiernet.net>
    Re: HTML in email (Mike Brittain)
    Re: HTML in email (Sam Holden)
    Re: HTML in email (Mike Brittain)
    Re: HTML in email (Sam Holden)
    Re: My file keeps getting clobbered! (M.J.T. Guy)
    Re: Need Faster Approach (Larry Rosler)
    Re: Perl question <asquith@macconnect.com>
    Re: Perl question (Abigail)
        Problem with image display <psl1@home.com>
    Re: Problems sorting arrays correctly (M.J.T. Guy)
    Re: Reading words from text file <cassell@mail.cor.epa.gov>
    Re: Regex Question (Abigail)
    Re: Removing white space. <prauz@sprynet.com>
    Re: Searching binary file without slurping whole thing? (M.J.T. Guy)
    Re: Searching binary file without slurping whole thing? (M.J.T. Guy)
        sending data to another server help please <support@onlineauctions.co.uk>
    Re: Sorting a file <rwolfe@rwolfe.com>
    Re: Sorting a file (Abigail)
    Re: Sorting a file <walton@frontiernet.net>
    Re: using passing delimiter of regexp to sub (M.J.T. Guy)
    Re: Weird Perl problem (Abigail)
    Re: What isn't getting reset? (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 22 Mar 1999 01:38:12 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Can't read a text file with weird characters in it.  Help.
Message-Id: <36F5A0EF.16535A84@home.com>

[posted & mailed]

David L. Cassell wrote:
> 
> But since that means Jason is probably using a Wintel box, he might 
> not have 'perldoc'.

This is silly, especially when you are recommending to others using
ActivePerl to use perldoc -q.

One of the nice things about perldoc is that it does work on systems
without a proper man command.

Give enough tools to the POBs and they might just dig their way out.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 22 Mar 1999 01:39:00 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Can't read a text file with weird characters in it.  Help.
Message-Id: <7d46vk$jlu$1@pegasus.csx.cam.ac.uk>

David L. Cassell <cassell@mail.cor.epa.gov> wrote:
>M.J.T. Guy wrote:
>> perldoc -f binmode
>
>But since that means Jason is probably using a Wintel box, he might not
>have 'perldoc'.  Jason, I hope you're using a modern version of ActivePerl.
>If so; pull up the online docs, pick the perlfunc webpage, click on the
>functions-in-alphabetical-order URI, and scroll down to read about binmode.

If he has a correctly installed Perl, he has perldoc.   'perldoc' is
the form of the documentation which should be portable across all
platforms.

But of course, he may well find the HTML pages more convenient.


Mike Guy


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

Date: Sun, 21 Mar 1999 21:28:00 -0500
From: Bob Walton <walton@frontiernet.net>
To: Lloyd Randall <randalll@gte.net>
Subject: Re: Converting an unsigned 16 bit integer to decimal ??  Help pleas
Message-Id: <36F5AAB0.B01DDCB3@frontiernet.net>

Try:

$d=unpack('S2',substr($buffer,6,2));
print "d=$d\n";

On your $buffer, this prints:

d=18260

Lloyd Randall wrote:

> #
> # Can anyone please tell me how to take a binary, 2 byte field which is
> supposed to
> # contain a 16 bit Unsigned Integer from a received message and convert it
> to decimal???
> #
> # I am receiving a message via a socket connection from a client, and in the
> message that
> # I am receiving, there is an Unsigned 16 bit Integer field in byte numbers
> 7 and 8 that
> # is supposed to tell me the complete message length so that I will know if
> I have
> # received the whole message or not.
> #
> # This should be pretty easy right???
> # Well, not for me... I am really new at this.
> #
> # Let's say for example that message length number number is:
> # Decimal 18260
> # Binary  0100011101010100
> # Hex     4754
> #
> # The ASCII Character represented by 47 Hex is "G"
> # The ASCII Character represented by 54 Hex is "T"
> #
> # I have been lead to beleive that Unsigned Integers are stored with the
> low-order byte
> # before the high-order byte. That is why, in the $buffer= statement below,
> I have put
> # the ASCII charaters T and G in byte positions 7 and 8 respectively.
> (reversed order).
> # This is how I anticipate receiving data from another computer into
> $buffer.
> # I would expect to see the incoming binary as 0101010001000111 if my
> reversed byte
> # theroy is true.
>
> # There has got to be an easy way to do this with pack and unpack but
> unfortunately,
> # my feeble brain just doesn't get it......  I have read the books and the
> FAQs but
> # still I am sooooo confused!!!!  Any help would certainly be very much
> appreciated.
> # Thanks.
>
> # My stupid way of doing this...
>
> $buffer="xxxxxxTGxxxxxxx";
>
> $seventhbyte=substr($buffer,6,1);
> $eighthbyte=substr($buffer,7,1);
> $swapedbytes = $eighthbyte.$seventhbyte;
>
> $binary= (join('',unpack('B*',"$swapedbytes")));
> print"lenght of Binary in bytes = ",length($binary),"\n";
> print"Binary = $binary\n";
>
>                                # I tried this too:
> $decimal=pack('B16',$binary);
>                                #                              print"Decimal
> = $decimal\n";
>                                #     it just gives me back the ASCII
> Characters "GT"
>
> $sum=0;
>
> if (substr($binary,0,1)  eq "1") {$sum=$sum+32768;}
> if (substr($binary,1,1)  eq "1") {$sum=$sum+16384;}
> if (substr($binary,2,1)  eq "1") {$sum=$sum+8192;}
> if (substr($binary,3,1)  eq "1") {$sum=$sum+4096;}
> if (substr($binary,4,1)  eq "1") {$sum=$sum+2048;}
> if (substr($binary,5,1)  eq "1") {$sum=$sum+1024;}
> if (substr($binary,6,1)  eq "1") {$sum=$sum+512;}
> if (substr($binary,7,1)  eq "1") {$sum=$sum+256;}
> if (substr($binary,8,1)  eq "1") {$sum=$sum+128;}
> if (substr($binary,9,1)  eq "1") {$sum=$sum+64;}
> if (substr($binary,10,1) eq "1") {$sum=$sum+32;}
> if (substr($binary,11,1) eq "1") {$sum=$sum+16;}
> if (substr($binary,12,1) eq "1") {$sum=$sum+8;}
> if (substr($binary,13,1) eq "1") {$sum=$sum+4;}
> if (substr($binary,14,1) eq "1") {$sum=$sum+2;}
> if (substr($binary,15,1) eq "1") {$sum=$sum+1;}
> print "Sum = $sum\n";
>
> sleep(10);



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

Date: 22 Mar 1999 00:14:12 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: CPAN
Message-Id: <slrn7fb2qk.llc.sholden@pgrad.cs.usyd.edu.au>

On Sat, 20 Mar 1999 17:27:12 -0600, Lee <rlb@intrinsix.ca> wrote:
>In article <m1ww0caxbo.fsf@halfdome.holdit.com>,
>merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>
>>Jonathan> Why would you *want* all of CPAN in one large file ?  There
>>Jonathan> are literally thousands of files and many of these are
>>Jonathan> various revisions of the same Modules.  The tar file of the
>>Jonathan> entire contents of CPAN would certainly be in the tens of
>>Jonathan> Megabytes if not more.
>>
>>I just checked -- today's CPAN is 742 megs, and it's not likely to
>>compress much since nearly everything in it is already a .tar.gz.
>
>To actually answer the question, though (a revolutionary concept for this
>ng, I know) a complete (but out of date, of course) CPAN is included on CD
>with O'Reilly's "Perl Resource Kit".

But that doesn't answer the question. The question specifically asked
if CPAN was available in *one* file. The answers given were 'no'.

A collection of files on a CD does not count as a file, unless you are 
talking about the cd image, which means the real answer would be, yes, most
CPAN sites only use one disk for CPAN stuff, so just ask for a copy of
the disk image...

-- 
Sam

You can blame it all on the internet. I do...
	--Larry Wall


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

Date: Mon, 22 Mar 1999 01:25:47 GMT
From: Ray McVay <rmcvay@acm.org>
Subject: Re: Forwarding to home directory using Net::FTP
Message-Id: <36F599B4.F6D09164@acm.org>

"Kevin S (xS)" wrote:
> 
> It does on most ftp clients because they have code built in to send you to
> the specifiied home directory. Unfortunately I couldn't find that code in
> any of the ftp rfc's.

Well I've damned sure been wrong before but I sure don't think so this
time.  My experience with NET::FTP is that it works just the same as all
the FTP clients I've used in this regard.  It looks like what I see
happen with WSFTP for example is that it does a PWD as soon as it's
logged on.  Also the site I just tested on has the ftpd set up to make
my user's home look like '/'; is that what you're refering to?

-- 

Ray
+--------------------------------------------------+
+ I've gone to look for myself. If I should return +
+ before I get back, keep me here!! - Bill the Cat +
+--------------------------------------------------+



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

Date: Mon, 22 Mar 1999 00:26:29 +0000
From: On Line Auctions UK <support@onlineauctions.co.uk>
Subject: Help Needed Please!!!
Message-Id: <36F58E34.89FBC2D3@onlineauctions.co.uk>

If any one could answer this for me i'd be eternally grateful.
I've got a html form that sends three fields to a cgi script but the cgi
script doesn't read the fields. It works on my own computer but when i
upload it to the server it doesn't. here's a cut down version of the
html code and below that is the cgi script.

<FORM ACTION="http://www.host.com/ucgi-bin/tyh/g.cgi" METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
<CENTER>
<P>
<TABLE BORDER="3" WIDTH="95%" HEIGHT="76" BGCOLOR="#FFCC00">
 <TR>
  <TD WIDTH="100%" HEIGHT="62">
   <CENTER>
   <P><B><FONT COLOR="blue" FACE="Futurist">Type</FONT></B><FONT
SIZE="2" COLOR="#000099" FACE="Futurist">
   <SELECT NAME="type">
   <OPTION SELECTED>Sail</OPTION>
   <OPTION>Motor Sail</OPTION>
   </SELECT>
 </FONT><B><FONT COLOR="blue" FACE="Futurist">Length ft</FONT></B><FONT
SIZE="1" COLOR="blue" FACE="Futurist">

   <SELECT NAME="lenght">
   <OPTION SELECTED>10-15</OPTION>
   <OPTION>16-20</OPTION>
     </SELECT>
 </FONT><B><FONT COLOR="blue" FACE="Futurist">Price
&pound;</FONT></B><FONT SIZE="1" FACE="Futurist">
   <SELECT NAME="price">
   <OPTION>1000-10000</OPTION>
   <OPTION SELECTED>10000-20000</OPTION>
   <OPTION>20000-30000</OPTION>
   </SELECT>
 <INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Search"></FONT>

CGI Script,
#!/bin/perl

$count = 0;
$type = "Sail";

&readdata;

sub readdata {

  #read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

  $buffer = $ENV{QUERY_STRING};

  @pairs = split(/&/, $buffer);

  foreach $pair (@pairs) {

    ($name, $value) =  split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $fromweb{$name} = $value;
  }

  $type = $fromweb{"type"};
  $lenght = $fromweb{"lenght"};
  $price = $fromweb{"price"};

  print "Content-type: text/html\n\n";
  print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">
  <HTML>

  <HEAD>
   <META HTTP-EQUIV=\"Content-Type\"
CONTENT=\"text/html;CHARSET=iso-8859-1\">
   <META NAME=\"GENERATOR\" Content=\"Visual Page 1.1 for Windows\">
   <TITLE>untitled</TITLE>
  </HEAD>

  <BODY>

  <P>
  <FRAMESET   COLS = \"18%,82% \"  >
     <FRAME
SRC=\"http://www.host.com/ucgi-bin/tyh/read.cgi?type=$type&lenght=$lenght&price=$price\"
NAME=\"Frame8116318\" RESIZE>
     <FRAME
SRC=\"http://www.host.com/ucgi-bin/tyh/main.cgi?number=100015\"
NAME=\"Frame8116332\" RESIZE>
  </FRAMESET>

  <NOFRAMES>

  </BODY>

  </NOFRAMES>

</HTML>";


Please help because i've run out of ideas.

Gary Mayor



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

Date: Sun, 21 Mar 1999 20:01:09 -0500
From: Bob Walton <walton@frontiernet.net>
Subject: Re: Help Needed Please!!!
Message-Id: <36F59655.E164E35D@frontiernet.net>

Gary, your description of "doesn't work" leaves a lot of space.  If you really want help,
you should state *exactly* what happens, and give:  perl version, OS and version of web
client and web server systems, perl version on web server system, name and version of web
server software, etc.  My guess is the you have a Unix web server, that the web server is
attempting to run the CGI script under user "nobody" (who has very limited permissions), and
that consequently, the web server does not have permission to read your CGI scripts.  One
fix is to give world read permission to the CGI script; another is to specify a user for the
web server to run under, and set the CGI script up with permissions which enable that user
to read the CGI script.  You do, of course, want to be very careful about giving broad
permissions to the processes running your CGI scripts.

Also, such problems would be better addressed by the comp.infosystems.www.authoring.cgi
newsgroup -- but you might not have known that, since you thought you had a perl problem.

On Line Auctions UK wrote:

> If any one could answer this for me i'd be eternally grateful.
> I've got a html form that sends three fields to a cgi script but the cgi
> script doesn't read the fields. It works on my own computer but when i
> upload it to the server it doesn't. here's a cut down version of the
> html code and below that is the cgi script.
>
> <FORM ACTION="http://www.host.com/ucgi-bin/tyh/g.cgi" METHOD="POST"
> ENCTYPE="application/x-www-form-urlencoded">
> <CENTER>
> <P>
> <TABLE BORDER="3" WIDTH="95%" HEIGHT="76" BGCOLOR="#FFCC00">
>  <TR>
>   <TD WIDTH="100%" HEIGHT="62">
>    <CENTER>
>    <P><B><FONT COLOR="blue" FACE="Futurist">Type</FONT></B><FONT
> SIZE="2" COLOR="#000099" FACE="Futurist">
>    <SELECT NAME="type">
>    <OPTION SELECTED>Sail</OPTION>
>    <OPTION>Motor Sail</OPTION>
>    </SELECT>
>  </FONT><B><FONT COLOR="blue" FACE="Futurist">Length ft</FONT></B><FONT
> SIZE="1" COLOR="blue" FACE="Futurist">
>
>    <SELECT NAME="lenght">
>    <OPTION SELECTED>10-15</OPTION>
>    <OPTION>16-20</OPTION>
>      </SELECT>
>  </FONT><B><FONT COLOR="blue" FACE="Futurist">Price
> &pound;</FONT></B><FONT SIZE="1" FACE="Futurist">
>    <SELECT NAME="price">
>    <OPTION>1000-10000</OPTION>
>    <OPTION SELECTED>10000-20000</OPTION>
>    <OPTION>20000-30000</OPTION>
>    </SELECT>
>  <INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Search"></FONT>
>
> CGI Script,
> #!/bin/perl
>
> $count = 0;
> $type = "Sail";
>
> &readdata;
>
> sub readdata {
>
>   #read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>
>   $buffer = $ENV{QUERY_STRING};
>
>   @pairs = split(/&/, $buffer);
>
>   foreach $pair (@pairs) {
>
>     ($name, $value) =  split(/=/, $pair);
>     $value =~ tr/+/ /;
>     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>     $fromweb{$name} = $value;
>   }
>
>   $type = $fromweb{"type"};
>   $lenght = $fromweb{"lenght"};
>   $price = $fromweb{"price"};
>
>   print "Content-type: text/html\n\n";
>   print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">
>   <HTML>
>
>   <HEAD>
>    <META HTTP-EQUIV=\"Content-Type\"
> CONTENT=\"text/html;CHARSET=iso-8859-1\">
>    <META NAME=\"GENERATOR\" Content=\"Visual Page 1.1 for Windows\">
>    <TITLE>untitled</TITLE>
>   </HEAD>
>
>   <BODY>
>
>   <P>
>   <FRAMESET   COLS = \"18%,82% \"  >
>      <FRAME
> SRC=\"http://www.host.com/ucgi-bin/tyh/read.cgi?type=$type&lenght=$lenght&price=$price\"
> NAME=\"Frame8116318\" RESIZE>
>      <FRAME
> SRC=\"http://www.host.com/ucgi-bin/tyh/main.cgi?number=100015\"
> NAME=\"Frame8116332\" RESIZE>
>   </FRAMESET>
>
>   <NOFRAMES>
>
>   </BODY>
>
>   </NOFRAMES>
>
> </HTML>";
>
> Please help because i've run out of ideas.
>
> Gary Mayor



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

Date: Mon, 22 Mar 1999 01:11:59 GMT
From: britts@pyro.net (Mike Brittain)
Subject: Re: HTML in email
Message-Id: <36f59729.28811106@news.pyro.net>

On Sun, 21 Mar 1999 17:55:34 -0500, "Brian"
<brian@removethisnet-weaver.com> wrote:

> Is there something I need to add
>in my script to tell the email program that this is html and should be
>displayed?

>    print MAIL "From: $in{'author'}\n";
>    print MAIL "Subject: Article Submission\n\n";
>    print MAIL "Content-Type: \"text/html;\"\n\n";
>    print MAIL "<HTML>\n";
>    print MAIL "<HEAD>\n";

I have never printed HTML to an email client, but as long as it works
the same way, you should print the same Content-type header as you
would for an HTML page:

	print MAIL 'Content-type: text/html\n\n';

I think that the line you are using includes quotes around text/html
and has an extra colon that doesn't need to be there.  Also, I don't
know that 'Type' needs to be capitalized or whether is specifically
SHOULDN'T.  I know I always use it lowercase -- 'type'.

I also think that since this DOESN'T seem to relate at all to
comp.lang.perl.modules, it shouldn't be posted there. =)


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

Date: 22 Mar 1999 01:39:31 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: HTML in email
Message-Id: <slrn7fb7qj.paa.sholden@pgrad.cs.usyd.edu.au>

On Mon, 22 Mar 1999 01:11:59 GMT, Mike Brittain <britts@pyro.net> wrote:
>On Sun, 21 Mar 1999 17:55:34 -0500, "Brian"
><brian@removethisnet-weaver.com> wrote:
>
>> Is there something I need to add
>>in my script to tell the email program that this is html and should be
>>displayed?
>
>>    print MAIL "From: $in{'author'}\n";
>>    print MAIL "Subject: Article Submission\n\n";
>>    print MAIL "Content-Type: \"text/html;\"\n\n";
>>    print MAIL "<HTML>\n";
>>    print MAIL "<HEAD>\n";
>
>I have never printed HTML to an email client, but as long as it works
>the same way, you should print the same Content-type header as you
>would for an HTML page:
>
>	print MAIL 'Content-type: text/html\n\n';

That just doesn't work. 

A 5 second test would have shown that to you.

-- 
Sam

Remember that the P in Perl stands for Practical.  The P in Python
doesn't seem to stand for anything.
	--Randal Schwartz in <8cemsabtef.fsf@gadget.cscaper.com>


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

Date: Mon, 22 Mar 1999 02:22:09 GMT
From: britts@pyro.net (Mike Brittain)
Subject: Re: HTML in email
Message-Id: <36f5a7b4.33047619@news.pyro.net>

On 22 Mar 1999 01:39:31 GMT, sholden@pgrad.cs.usyd.edu.au (Sam Holden)
wrote:

>On Mon, 22 Mar 1999 01:11:59 GMT, Mike Brittain <britts@pyro.net> wrote:
>>On Sun, 21 Mar 1999 17:55:34 -0500, "Brian"
>><brian@removethisnet-weaver.com> wrote:
>>
>>> Is there something I need to add
>>>in my script to tell the email program that this is html and should be
>>>displayed?
>>
>>>    print MAIL "From: $in{'author'}\n";
>>>    print MAIL "Subject: Article Submission\n\n";
>>>    print MAIL "Content-Type: \"text/html;\"\n\n";
>>>    print MAIL "<HTML>\n";
>>>    print MAIL "<HEAD>\n";
>>
>>I have never printed HTML to an email client, but as long as it works
>>the same way, you should print the same Content-type header as you
>>would for an HTML page:
>>
>>	print MAIL 'Content-type: text/html\n\n';
>
>That just doesn't work. 
>
>A 5 second test would have shown that to you.

Yeah, you're right.  This is the line that I have been using:

	print "Content-type: text/html\n\n";

Now, I realize that I am not printing to a pipe, but this line -- with
double quotes -- does print a header for HTML.  I had ASS-umed that
single quotes would work as well.  What is the discrepancy there???

-mike



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

Date: 22 Mar 1999 02:30:00 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: HTML in email
Message-Id: <slrn7fbap8.r6b.sholden@pgrad.cs.usyd.edu.au>

On Mon, 22 Mar 1999 02:22:09 GMT, Mike Brittain <britts@pyro.net> wrote:
>On 22 Mar 1999 01:39:31 GMT, sholden@pgrad.cs.usyd.edu.au (Sam Holden)
>wrote:
>
>>On Mon, 22 Mar 1999 01:11:59 GMT, Mike Brittain <britts@pyro.net> wrote:
>>>
>>>	print MAIL 'Content-type: text/html\n\n';
>>
>>That just doesn't work. 
>>
>>A 5 second test would have shown that to you.
>
>Yeah, you're right.  This is the line that I have been using:
>
>	print "Content-type: text/html\n\n";
>
>Now, I realize that I am not printing to a pipe, but this line -- with
>double quotes -- does print a header for HTML.  I had ASS-umed that
>single quotes would work as well.  What is the discrepancy there???

perldoc perlop (the section on 'Quote and Quote-like Operators')

-- 
Sam

So I did some research. On the Web, of course. Big mistake...
	--Larry Wall


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

Date: 22 Mar 1999 01:45:43 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: My file keeps getting clobbered!
Message-Id: <7d47c7$jtn$1@pegasus.csx.cam.ac.uk>

In article <36F55CC9.CD67CA85@bol.net>, sara starre  <webqueen@bol.net> wrote:
>I have a textfile that numerous users update through perl print
>statements and copy() commands. The file is about 10k lines.
>
>About 3 times a day it  turns 100 to 2000 lines into one giant line,
>which in vi looks like screenfuls of NULL chars I guess. The lines
>appear to be garbled too- if I insert CR every 80 chars there seems to
>be some lines missing and others shortened.
>
>I tried adding flock (exclusive) during updates- no improvement. I tried
>replacing system calls (to cp) with copy(f1,f2). I tried checking the
>length of each line that I print to the file. None of these remedies
>made any difference.

You may *think* you are using flock(), but it's notoriously easy to
do it incorrectly.     If you haven't already done so, check out the
entries relating to locking in perlfaq5.

And if you think you are doing it correctly, try posting the relevant
code to see if we agree with you.    :-)


Mike Guy


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

Date: Sun, 21 Mar 1999 06:08:13 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need Faster Approach
Message-Id: <MPG.115e9d24896a58f98979d@nntp.hpl.hp.com>

In article <1doztnr.1phdgcqdb7ex5N@[207.60.170.22]> on Sun, 21 Mar 1999 
02:11:03 -0500, Ronald J Kimball <rjk@linguist.dartmouth.edu >says...
 ... 
> Benchmark: timing 16 iterations of index, split...
>      index:  8 secs ( 7.24 usr  0.02 sys =  7.26 cpu)
>      split:  9 secs ( 9.17 usr  0.15 sys =  9.32 cpu)
> 
> As you can see, both solutions are rather slow; about a half-second for
> a single iteration.  But the index() solution has an edge over the
> split() solution, presumably due to the overhead of allocating a 75,051
> element array.
> 
> perl5.004_04, using perl's malloc.

Having advocated split() over index() without trying it, I'll own up 
with another measurement.

Benchmark: timing 16 iterations of index, split...
     index: 16 wallclock secs (15.33 usr +  0.00 sys = 15.33 CPU)
     split: 28 wallclock secs (28.45 usr +  0.00 sys = 28.45 CPU)

ActivePerl 5.005_02 build 509, using a Pentium (165 MHz, 80 MB).

Thanks for writing the benchmark.   :-(   :-)

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


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

Date: Sun, 21 Mar 1999 18:14:33 -0600
From: "William H. Asquith" <asquith@macconnect.com>
Subject: Re: Perl question
Message-Id: <7d42bt$7kd@enews1.newsguy.com>

> It works fine except when a user tries to enter multiple lines
> separated by an enter (newline).  In this case, perl only displays the
> first line (i.e. everything up to the newline character).  I've been
> told that this is because a newline is a default record delimeter.

Are you reading correctly?
$line = <STDIN>;  # will grab only one line of text

$/ = "\n"; # Record separator variable, which is \n as default

If you want to read multiple lines in with out a while loop
$/='go'
$lines = <STDIN>; # Will read multile records until user types go.

Another way for multiple lines
$_ = <STDIN>;  # read first line from user
until($_ =~ m/^\n$/) {  # do this block until $_ matches just a new line
    push(@lines,$_); # load line into @lines;
    $_ = <STDIN>;  # read subsequent lines, note that \n is left on
}

Without further details it is difficult to see your problem.


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

Date: 22 Mar 1999 01:35:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl question
Message-Id: <7d46oc$nkh$5@client2.news.psi.net>

q969@truman.edu (q969@truman.edu) wrote on MMXXVIII September MCMXCIII in
<URL:news:36f56f64.91746384@news.truman.edu>:
{} I've never posted here before, and I'm unsure whether this is the
{} appropriate forum to ask perl question, but I'll try it anyway.
{} 
{} I'm new to perl and I've written a script to pull data from a
{} form-enabled web page.  It then writes the data to a text file (this
{} is on a unix web server).  It also has a feature by which the user can
{} revise previously entered data.  In this case, it reads data from the
{} text file and displays as a web page.
{} 
{} It works fine except when a user tries to enter multiple lines
{} separated by an enter (newline).  In this case, perl only displays the
{} first line (i.e. everything up to the newline character).  I've been
{} told that this is because a newline is a default record delimeter.
{} 
{} I've tried to use the =~ command to parse out newlines and replace
{} them with spaces (though any character would do).  The command I've
{} used is $value[$n] =~ s/\n/ /;  But this never works (I've tried
{} changing the 's' to a 'tr').  I get the same output to the text file
{} whether I include this line or not.
{} 


It's probably an error on line 17.


If you want an answer, post the *relevant* part of your code (noone wants
to debug 200 lines of code). We can't guess what you wrote.



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: Mon, 22 Mar 1999 02:54:35 GMT
From: Paul <psl1@home.com>
Subject: Problem with image display
Message-Id: <36F5B0BA.A589797F@home.com>

Hello all,

I am attempting to display an image (.gif) on a web page depending on
the time of day. When the script runs, instead of the gif image, I get a
broken image icon appearing in the web page.
Can anyone help this newbie to perl?  Below is the script:

#!/usr/local/bin/perl
#
# test.pl
#
#
#$| = 1;
$base = "./cgi-bin/";
$gif1 = "morning.gif";
$gif2 = "noon.gif";
$gif3 = "evening.gif";
#print "Content-Type: text/html\n\n\n";	
chop ( $hour = `/bin/date '+%H'` );	
# display image depending on the time of day
if ($hour < 12) { print "<CENTER><IMG SRC=\"$base$gif1\"></CENTER>\n"; }
if ($hour > 11) { if ($hour < 17) { print "<CENTER><IMG
SRC=\"$base$gif2\"></CENTER>\n"; }}
if ($hour > 16) { print "<CENTER><IMG SRC=\"$base$gif3\"></CENTER>\n" }

Thanks in advance for any help!

--Paul


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

Date: 22 Mar 1999 00:06:07 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problems sorting arrays correctly
Message-Id: <7d41hf$bk9$1@pegasus.csx.cam.ac.uk>

Asbjorn Gjemmestad <agjemmes@extremeonline.com> wrote:
>I'm having a problem sorting array elements using the sort function.
>
>Here is what I'm trying to do:
>
>The array elements look like this (examples) -
>
>30|2|4|2|dddd
>50|2|4|2|bbbb
>50|5|10|5|aaaa
>30|3|6|3|cccc
>
>The sorting procedure looks like this:
>
> @sorted = sort { $a <=> $b }@acc;
> @sorts = reverse(@sorted);
>
>Now the list should look like this (in my opinion):
>
>50|5|10|5|aaaa
>50|2|4|2|bbbb
>30|3|6|3|cccc
>30|2|4|2|dddd
>
>The problem is, the list is sorted like this:
>
>50|2|4|2|bbbb
>50|5|10|5|aaaa
>30|3|6|3|cccc
>30|2|4|2|dddd

You're using a numeric comparison <=>.   So Perl converts the arguments
to numbers, giving values 30, 50, 50, 30, and then sorts them as you
observe.

Learn to use -w *always*.   Then you'll get warned when you do things
like this.


Mike Guy


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

Date: Sun, 21 Mar 1999 16:14:00 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Reading words from text file
Message-Id: <36F58B48.22EE415E@mail.cor.epa.gov>

dinog@NOSPAMcanada.com wrote:
> 
> Thanks for the quick response.
> 
> I've gotten what you've said to work: read in the input file line by line and
> splitting it up into an array of words defined by whitespaces.  What I'm trying to
> do is compare 2 arrays of words: each created from file.  One file contains the
> master list of words while the second file contains words I'd like to check. If
> the second file contains words not in the master file, I'd like to add them to the
> master file.  Can you think of an efficient way to do this?  Loading up the master
> file words into a trie data struct would be ideal but I haven't found any packages
> with tries implemented.  Any thoughts?

Actually, this is well-covered in the FAQ.. complete with working code!  If you
have version 5.005, you can use the perldoc -q option to search for a keyword,
such as 'difference of two arrays'.  If you have an earlier version, the -q
option
may not be implemented, and you can still type 'perldoc perlfaq4' to get to the
info.  If you type 'perldoc' and your system doesn't know what you're talking
about, upgrade ASAF.
 
> Another quesiton:  Is there a quick way to remove unwanted elements from a file?
> eg. like substitute all periods with a space?

The substitution operator s/// will do it, but you might find it faster to use
the translation operator tr///:

$word =~ tr/a-zA-Z'/ /cs;  #change non-word stuff to a single space

Note that this assumes ' is a legal part of your words, like "isn't", and fails
on non-Anglo characters, such as anything accented.  For that, read up on
"use locale". 

> TIA,

HTH,
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 22 Mar 1999 01:57:36 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Regex Question
Message-Id: <7d482g$nou$1@client2.news.psi.net>

Gene Wilburn (gwilburn@home.com) wrote on MMXXVIII September MCMXCIII in
<URL:news:36F4FEEB.52C86F99@home.com>:
## Jonathan Stowe wrote:
## > 
## [snip]
## 
## > I'm not entirely sure what it is that you are doing here but just for fun
## > here is my take on it (gotta prove I didnt wipe my brain out with beer last
## > night :) - It takes the 'cal' output and places it in a two dimensional array
## > padding as appropriate ( I have used '*'s to see what is going on but you
## > might want to use something else):
## > 
## [snip]
## 
## Nice coding example! It does exactly what I'm looking for. The 'split'
## solutions don't work because I'm attempting to preserve blank days in
## the array (which you've padded with '*'). Once this two dimensional
## array has been built, it provides a perfect map for building an calendar
## display in HTML.


Well, the regex didn't work because you were attempting to preserve
blank days. As you've noticed, at the end of the month, there are not
blanks. 

split works. You've just to take care of the cases with less than 7 days.

But you had to do that already, else you wouldn't have asked here.


split is the way to go.




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


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

Date: Mon, 22 Mar 1999 02:50:58 +0000
From: prauz <prauz@sprynet.com>
Subject: Re: Removing white space.
Message-Id: <36F5B012.30DA5B94@sprynet.com>

Brahmdeep Jandir wrote:

> I am sure this has been asked at least a million times .... but please bear
> with me.
>
> $text =~ s#^\s*(.*)\s*$#$1#;
> $text =~ s#(.*)\s*$#$1#;
>
> Will the two above statements remove the white space at the end of the
> string or not ??
> They do not for me ! Why ??
>

They don't work, because the '*' is a hungry operator and .* eats up all
characters including whitespaces.

Had you read the FAQ you would've seen:

===========================================================================

How do I strip blank space from the beginning/end of a string?

Although the simplest approach would seem to be:

    $string =~ s/^\s*(.*?)\s*$/$1/;

This is unnecessarily slow, destructive, and fails with embedded newlines. It
is much better faster to do this in two steps:

    $string =~ s/^\s+//;
    $string =~ s/\s+$//;

Or more nicely written as:

    for ($string) {
        s/^\s+//;
        s/\s+$//;
    }

This idiom takes advantage of the foreach loop's aliasing behavior to factor
out common code. You can do this on several strings at once, or arrays, or
even the values of a hash if you use a slide:

    # trim whitespace in the scalar, the array,
    # and all the values in the hash
    foreach ($scalar, @array, @hash{keys %hash}) {
        s/^\s+//;
        s/\s+$//;
    }

======================================================================

I hope this helped, if not just tell it to Tom Christiansen ;)

Balazs



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

Date: 22 Mar 1999 02:08:34 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Searching binary file without slurping whole thing?
Message-Id: <7d48n2$lfe$1@pegasus.csx.cam.ac.uk>

In article <F8uxFD.780@unx.sas.com>, Chris Sherman <sherman@unx.sas.com> wrote:
>I would like to search a binary file without slurping in the
>whole thing.  Is this possible?

Well, if need to read the whole file, then, um, you need to read the
whole file.

>Ok, so I could also do it like this (taking 100K chunks at a time)...

Reading in chunks like this is about as efficient as you can get.

>vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
>#!/usr/local/bin/perl5 -w
>use strict;
>
>my $file=$ARGV[0] || "/tmp/huge_binary_file";
>
>open FIN,"<$file" or die "Could not open $file: $!\n";
>
>undef $/;
>$|=1;
>
>my $seg="";
>my $sseg="";   # just in case search string sits on a boundary
>
>while (read(FIN,$seg,131072)) {
>
>   if ("${sseg}${seg}" =~ /version=(\d+\.\d+)/) {
>   #if (<FIN> =~ /SAS_=(\d+\.\d+)/) {
>      print "\nversion is $1\n";
>      last;
>   }
>   $sseg=substr $seg, -50;
>   print ".";
>}
>
>
>close(FIN);
>
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

But you're doing unnecessary work by copying your buffer.   Use the
OFFSET option of read() to avoid this.    (Untested code follows  -
beware of typos):

my $file=$ARGV[0] || "/tmp/huge_binary_file";

open FIN,"<$file" or die "Could not open $file: $!\n";

undef $/;
$|=1;

my $seg="";
my $offset = 0;

while (read(FIN,$seg,131072,$offset)) {

   if ($seg =~ /version=(\d+\.\d+)/) {
      print "\nversion is $1\n";
      last;
   }
   $offset = length $seg > 50 ? 50 : length $seg;
   substr($seg, 0, $offset) = substr($seg, -$offset);
   print ".";
}

close(FIN);


Mike Guy


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

Date: 22 Mar 1999 02:13:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Searching binary file without slurping whole thing?
Message-Id: <7d4903$lmq$1@pegasus.csx.cam.ac.uk>

I wrote:
>
>Reading in chunks like this is about as efficient as you can get.

I should also have said to use sysread() rather than read(), as that will
bypass stdio buffering.


Mike Guy


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

Date: Mon, 22 Mar 1999 00:54:26 +0000
From: Gary Mayor <support@onlineauctions.co.uk>
Subject: sending data to another server help please
Message-Id: <36F594C2.EF8FEA3F@onlineauctions.co.uk>

Hello i need urgent help on this please. I need to send data from a cgi
script to another cgi script on another server. I've got a script on the
recieving server that can read data through a normal browser process
such as http://www.recieving host.com/cgi-bin/read.cgi?var1=data but how
do i code this in perl any ideas?

Thank you

Gary Mayor



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

Date: Mon, 22 Mar 1999 01:00:49 GMT
From: Richard Wolfe <rwolfe@rwolfe.com>
Subject: Re: Sorting a file
Message-Id: <36F5B274.299EF21A@rwolfe.com>

TMTOWTDI, obviously, but something like this might work (so long as the
file in question is not enormous):

open(PEOPLE,"/path/to/your/file");

# make a hash (%people) that has "last name, first name" for keys
while ($line = <PEOPLE>) {
  $person .= $line;
  if ($line =~ /\\end{person}/) {
    ($name) = ($person =~ /\\begin{person}{(.+)}/);
    $people{$name} = $person;
    $person = "";
  }
}
close(PEOPLE);

# make a sorted array of the hash's keys
@keys = sort (keys %people);
foreach $key (@keys) {
  print "$people{$key}";
}



HTH,
   Richard Wolfe




Bernd Schandl wrote:
> 
> I have a file which looks basically like this:
> 
> \begin{person}{Dion, Celine}
>   \name{Celine Dion}
>   some text for CD
> \end{person}
> \begin{person}{Cooper, Gary}
>   \name{Gary Cooper}
>   some text for GC
> \end{person}
> \begin{person}{Day, Doris}
>   \name{Doris Day}
>   some text for DD
> \end{person}
> 
> This file should be sorted and come out like this:
> 
> \begin{person}{Cooper, Gary}
>   \name{Gary Cooper}
>   some text for GC
> \end{person}
> \begin{person}{Day, Doris}
>   \name{Doris Day}
>   some text for DD
> \end{person}
> \begin{person}{Dion, Celine}
>   \name{Celine Dion}
>   some text for CD
> \end{person}
> 
> How can I do this with PERL?
> Thanks
>         Bernd
> --
> Bernd Schandl
> Department of Mathematical Sciences
> Clemson University
> Clemson, SC 29634-1907


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

Date: 22 Mar 1999 02:00:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Sorting a file
Message-Id: <7d4877$nou$2@client2.news.psi.net>

Bernd Schandl (bschand@math.clemson.edu) wrote on MMXXVIII September
MCMXCIII in <URL:news:36F56D59.C7F50E1E@math.clemson.edu>:
[] I have a file which looks basically like this:
[] 
[] This file should be sorted and come out like this:
[] 
[] How can I do this with PERL?


Read in the file in an array, each record in an element. Sort it.
Then write out the array.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: Sun, 21 Mar 1999 21:15:31 -0500
From: Bob Walton <walton@frontiernet.net>
To: Bernd Schandl <bschand@math.clemson.edu>
Subject: Re: Sorting a file
Message-Id: <36F5A7C2.A7D7A1CE@frontiernet.net>

Something like this should do the job you want...

open IN,"data1.txt" or die "Couldn't open data1.txt, $!\n";
while(<IN>){
 $in[$i].=$_ if length($_)>1; #if is in case of extraneous newlines
 $i++ if $_=~/\\end/;
}
close IN or die "Couldn't close data1.txt, $!\n";
@index=sort byname (0..$#in);
for(@index){
 print "$in[$_]";
}

sub byname{
 my $av=$in[$a];
 my $bv=$in[$b];
 $av=~/\{person\}\{([^}]+)\}/;
 my $aname=$1;
 $bv=~/\{person\}\{([^}]+)\}/;
 my $bname=$1;
 $aname cmp $bname;
}

Some guru can probably shorten that to one line?

Bernd Schandl wrote:

> I have a file which looks basically like this:
>
> \begin{person}{Dion, Celine}
>   \name{Celine Dion}
>   some text for CD
> \end{person}
> \begin{person}{Cooper, Gary}
>   \name{Gary Cooper}
>   some text for GC
> \end{person}
> \begin{person}{Day, Doris}
>   \name{Doris Day}
>   some text for DD
> \end{person}
>
> This file should be sorted and come out like this:
>
> \begin{person}{Cooper, Gary}
>   \name{Gary Cooper}
>   some text for GC
> \end{person}
> \begin{person}{Day, Doris}
>   \name{Doris Day}
>   some text for DD
> \end{person}
> \begin{person}{Dion, Celine}
>   \name{Celine Dion}
>   some text for CD
> \end{person}
>
> How can I do this with PERL?
> Thanks
>         Bernd
> --
> Bernd Schandl
> Department of Mathematical Sciences
> Clemson University
> Clemson, SC 29634-1907



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

Date: 22 Mar 1999 02:22:54 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: using passing delimiter of regexp to sub
Message-Id: <7d49hu$m73$1@pegasus.csx.cam.ac.uk>

In article <36F56138.62D8CA01@hotmail.com>, Zenno  <zenno22@hotmail.com> wrote:
>How can I pass a char to a function and use that char as a delimiter in
>a regexp?
>
>@LoL = get_FileText_LOL($aFilePath.'|'); # read the file in a LoL
>
>sub get_FileText_LOL {
> my($file) = @_;
> my($delimiter) = pop(@_);

Though correct, those two lines aren't very idiomatic perl.   I'd
write them as

  my ($file, $delimiter) = @_;

or as

  my $file = shift;
  my $delimiter = shift;

> my(@LoL) = ();
>
> open(FILEHANDLE, "<$file") || &file_open_error("can\'t read open file
>$file $!\n");
> foreach $line(<FILEHANDLE>) {
>  @tmp = split(/$delimiter/,$line); #The words in this file are
>separated by a "|" symbol.

Since | is a special character in a regular expression, that is
equivalent to split(//,$line).

Protect against this by using \Q :

   @tmp = split(/\Q$delimiter/,$line);


Mike Guy


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

Date: 22 Mar 1999 02:02:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Weird Perl problem
Message-Id: <7d48bc$nou$3@client2.news.psi.net>

Kavian Moradhassel (kavian@nortelnetworks.com) wrote on MMXXVIII
September MCMXCIII in <URL:news:7d3r26$eu2$1@bmerhc5e.ca.nortel.com>:
__ 
__ The details:  The script is a five-line driver script using a Perl module
__ (which subsequently 'use's three or four other modules) with 'use strict'
__ and the '-w' switch on.  It's running as a CGI executing with Perl 5.00502
__ on an Apache server on an HPUX 10.20 machine (a Merlin, I believe).


Those are the "details"? A pretty vague description? 4 lines of text,
describing 5 lines of code? How about being a bit more detailed, and
at least displaying the second and fourth line of code?



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: 22 Mar 1999 02:05:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: What isn't getting reset?
Message-Id: <7d48i5$nou$4@client2.news.psi.net>

Barry Wegman (bwegman@HiWAAY.net) wrote on MMXXVIII September MCMXCIII in
<URL:news:3aBaWa8c#GA.211@pet.hiwaay.net>:
@@ $s = "This is a test of the American Broadcasting Service."
@@ @matches = ($s =~ /([tT]\S{1,})/);  ## NOTE: Not done globally!
@@ print "Matched: ", join(", ", @matches), "\n";
@@ @matches = ($s =~ /([tT]\S{1,})/g);
@@ print "Matched: ", join(", ", @matches), "\n";
@@ @matches = ($s =~ /([tT]\S{1,})/g);
@@ print "Matched: ", join(", ", @matches), "\n";
@@ 
@@ Forgive my newbie question, but the above code produces the
@@ following output, which I don't understand.  Can someone please
@@ explain it to me?  (Please E-mail me a copy of any responses.)
@@ 
@@ Matched: This
@@ Matched: test, the, ting
@@ Matched: This, test, the, ting
@@ 


That looks like a bug to me. If you are using an old version of Perl,
please upgrade, else, use the perlbug command.

$ perl -w
$s = "This is a test of the American Broadcasting Service.";
@matches = ($s =~ /([tT]\S{1,})/);  ## NOTE: Not done globally!
print "Matched: ", join(", ", @matches), "\n";
@matches = ($s =~ /([tT]\S{1,})/g);
print "Matched: ", join(", ", @matches), "\n";
@matches = ($s =~ /([tT]\S{1,})/g);
print "Matched: ", join(", ", @matches), "\n";
__END__
Matched: This
Matched: This, test, the, ting
Matched: This, test, the, ting
$



Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 5194
**************************************

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