[6261] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 883 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 2 14:18:30 1997

Date: Sun, 2 Feb 97 11:00:24 -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, 2 Feb 1997     Volume: 7 Number: 883

Today's topics:
     Re: Bidirectional sockets example in perl? (Chris Nandor)
     Re: Bug ? in Perl 5.003 for linux - or just me ?? (Andrew M. Langmead)
     Re: Bug ? in Perl 5.003 for linux - or just me ?? (Kevin Sullivan)
     Re: Color coding perl (Eric Harley)
     Re: Color coding perl (Elias Martenson)
     Re: Filehandle: open(FILE) while{} close(FILE) (Mr Simon Lee)
     Re: genetic algorithms (A. Deckers)
     Getting started <midiman@hotmail.com>
     Re: help with mail form <hamilte@one.net>
     Re: help with mail form (Nathan V. Patwardhan)
     HELP: How to speed up Perl scripts ? <konink@telebyte.nl>
     Re: HELP: How to speed up Perl scripts ? (Neil Bowers)
     Re: HELP: How to speed up Perl scripts ? (Nathan V. Patwardhan)
     Re: How do I supply password?? (Jon Orwant)
     Re: Invoking Perl program (Jon Orwant)
     Re: MacPerl FAQ? (Chris Nandor)
     Re: Need a way to calculate a random number between 1 a (Andrew M. Langmead)
     Re: Need a way to calculate a random number between 1 a (Chris Nandor)
     Re: Need help with variable manipulation <rootbeer@teleport.com>
     Re: New Group ideas: Splitting clpm (Chris Nandor)
     Possible bug -- should I try to isolate it? <andy@wonderworks.co.uk>
     Re: Question (Jon Orwant)
     Re: Really, really BIG files with MacPerl (Chris Nandor)
     Re: regex eats newline? (Dave Thomas)
     Re: saving problem (Tad McClellan)
     Re: sorting multidimensional arrays in perl? (Tad McClellan)
     Re: space stripping <merlyn@stonehenge.com>
     Re: space stripping <tchrist@mox.perl.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Sun, 02 Feb 1997 13:16:03 -0500
From: pudge@pcix.com (Chris Nandor)
Subject: Re: Bidirectional sockets example in perl?
Message-Id: <pudge-ya023480000202971316030001@news.idt.net>

Here is a script I wrote just yesterday as an example of sending mail using
Sockets.

You can also change &waitS to be something like:
   my($wait) = @_;
   while(<SOCK>) {
      print;
      last if (/^$wait/);
   }

and then pass the text you want to wait for.  It's tested on MacPerl 5.1.3
and Perl 5.003 for Solaris.  Hope this helps.

#!perl
use Socket;
$| = 1;
$lf = "\r\n";
$remote  = 'smtp.yourhost.com';
$port  = 25;
$iaddr   = inet_aton($remote)              or die "no host: $remote";
$paddr   = sockaddr_in($port, $iaddr);
$proto   = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(SOCK, $paddr)                      or die "connect: $!";
&waitS;
&printS("MAIL FROM: prez\@whitehouse.gov");
&waitS;
&printS("RCPT TO: you\@yourmail.com");
&waitS;
&printS("DATA");
&printS("test!");
&printS(".");
&waitS;
&printS("QUIT${lf}");
&waitS;
close(SOCK);

sub waitS {
   while(<SOCK>) {
      print;
      last if (/^\d{3} /);
   }
}

sub printS {
   my($t) = shift;
   print SOCK $t.$lf;
   print $t."\n";
}

__END__

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: Sun, 2 Feb 1997 15:41:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Bug ? in Perl 5.003 for linux - or just me ??
Message-Id: <E4zFLz.L7E@world.std.com>

C.Burke@mailbox.uq.edu.au (Christopher Burke) writes:

>What reason would adding a loop around the main call (which gets
>executed once either way) require the flush buffers, when without the
>loop it does not ?

Because exiting a program automatically flushes all stio buffers and
closes all files. An infinite loop around the file I/O calls prevents
the program from exiting.
-- 
Andrew Langmead


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

Date: 2 Feb 1997 16:07:52 GMT
From: ksulliva@psc.edu (Kevin Sullivan)
Subject: Re: Bug ? in Perl 5.003 for linux - or just me ??
Message-Id: <5d2e4o$con@news.psc.edu>

Christopher Burke (C.Burke@mailbox.uq.edu.au) wrote:
: What reason would adding a loop around the main call (which gets
: executed once either way) require the flush buffers, when without the
: loop it does not ?

All buffers get flushed when the program exits normally.  They do not
get flushed when you exit a program with ^C (which is probably the only
way to exit the looped program).  Thus you should either have buffers
auto-flush (as was mentioned before) or be sure to close all open files
before sleeping (closing a file will of course flush it).

	-Kevin Sullivan


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

Date: Sun, 02 Feb 1997 09:01:44 -0800
From: erich@powerwareintl.com (Eric Harley)
Subject: Re: Color coding perl
Message-Id: <erich-0202970901450001@ppp-207-104-16-33.snrf01.pacbell.net>

In article <32F2DCCD.3AC9@postoffice.worldnet.att.net>,
arichards@postoffice.worldnet.att.net wrote:

> try WinEdit  decent color coding once you
> modify the croma.ini and/or create your own pl.ini.
> 
> easy to drag and drop in windows.

BBEdit from BareBones Software (www.barebones.com)is a a great editor the
automaticly colors text for 20+ languages. Including Perl, Tcl/Tk, C,
Pascal, etc.


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

Date: 2 Feb 1997 17:21:11 GMT
From: elias@tip.omicron.se (Elias Martenson)
Subject: Re: Color coding perl
Message-Id: <5d2ie7$i2s@epimetheus.algonet.se>

In article <erich-0202970901450001@ppp-207-104-16-33.snrf01.pacbell.net>, Eric Harley wrote:
>In article <32F2DCCD.3AC9@postoffice.worldnet.att.net>,
>arichards@postoffice.worldnet.att.net wrote:
>
>> try WinEdit  decent color coding once you
>> modify the croma.ini and/or create your own pl.ini.
>> 
>> easy to drag and drop in windows.
>
>BBEdit from BareBones Software (www.barebones.com)is a a great editor the
>automaticly colors text for 20+ languages. Including Perl, Tcl/Tk, C,
>Pascal, etc.

XEmacs has the best of them all. http://www.xemacs.org

-- 
Elias Martenson
elias-m@algonet.se


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

Date: 2 Feb 1997 16:44:41 GMT
From: silee@news.hk.super.net (Mr Simon Lee)
Subject: Re: Filehandle: open(FILE) while{} close(FILE)
Message-Id: <5d2g9p$8cp@tst.hk.super.net>

Kenneth W. Lee (kenlee@congo.morgan.com) wrote:
: Hi all,

: My environment is as follows:

:   perl version: perl5
:       platform: xterm unix, SunOS Release 4.1.3 (SUN4M-CLIENT)

: Question:
: I'm having some difficulty with filehandles.  I've consulted
: the _Programming Perl_ (O'Reilly, 91) and _Perl5: How-To_
: (Waite Group, 96), but still have no idea what is wrong
: with the code below (I know I could do it in a line-command,
: but I'd like to learn how to code in the most verbose but
: elegant way):

: ---begin code---
: #!usr/bin/perl5 -w

: #
: # main
: #

: {
:     my $line;
:     my $infile = "DATA.TXT";

:     open ( INFILE, "<$infile" ) or die "Cannot open $infile:$!\n";
:     open ( OUTFILE, ">>$infile" ) or die "Cannot create $outfile:$!\n";

I would do:

while(<INFILE>) {
	s/FOO/BAR/;
	print $line;
        print OUTFILE $line;
}

Simon

:     $line = <INFILE>; 
:     while ( $line )
:     {
: 	s/FOO/BAR/;   # any kind of parser here
        **********
	you need $line =~ s/FOO/BAR/ instead, perl uses $_ by default

: 	print $line;
: 	print OUTFILE $line;
:     }
:     close( INFILE ) or die "Can't close $infile: $!";
:     close( OUTFILE )or die "Can't close $infile: $!";
: }
: ---end code---

: This problematically runs an endless loop when I'd like
: it terminated upon the last line of <INFILE>.  Is there 
: something I've missed?

: Thanks in advance,

: --
: Ken

: -- 



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

Date: 2 Feb 1997 13:48:13 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: genetic algorithms
Message-Id: <slrn5f96ot.371.Alain.Deckers@nessie.mcc.ac.uk>

In <32EE3F98.31DF11A2@enteract.com>,
	Eryq <eryq@enteract.com> wrote:
>Brian Atkins wrote:
>> 
>> Has anyone done and of these in Perl? I'd love to see some source
>> since I am just getting interested in this...
>
>Haven't tried it, but Perl should be a good language for
>fooling around with GA, for the same reasons Lisp is: namely,
>with garbage collection, variable-sized and typeless containers,
>the ability to eval(), and OO when you want it, you can throw 
>stuff together in a snap.

I seem to remember that someone submitted a GA written in Perl to the
3-sided prisoners dilemma competition in The Perl Journal #1.

-- 
Alain.Deckers@man.ac.uk          <URL:http://www.man.ac.uk/%7Embzalgd/>


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

Date: Sun, 02 Feb 1997 13:33:47 -0500
From: Ryguy <midiman@hotmail.com>
Subject: Getting started
Message-Id: <32F4DE0B.5A4C@hotmail.com>

I need help getting started writting in perl...
I would appriciate any help that I can get.
Thank you


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

Date: Sun, 02 Feb 1997 10:01:18 -0500
From: Elizabeth Hamilton <hamilte@one.net>
To: matt@apc.net
Subject: Re: help with mail form
Message-Id: <32F4AC3E.30D9@one.net>

Matt,

That's exactly what is supposed to happen. People using your form will
type their messages into this mail window. When you receive mail
messages from your form they will consist of long strings of data
separated with "+'s" "&'s" and hexidecimal codes. It's hard to read but
it's one way to use forms even if you can't run a CGI script.

Elizabeth

Matt wrote:
> 
> on my home page i would like to put a simple mail form...
> however, my server wont let me access the CGI-BIN
> im trying to do this :
> 
> <FORM METHOD="POST" ACTION="mailto:me@me.net">
> 
> everytime i click on the button i get a email window up..... can
> anyone help?
> 
> matt@apc.net

-- 
Elizabeth Hamilton
hamilte@one.net
http://w3.one.net/~hamilte/


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

Date: 2 Feb 1997 16:08:58 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: help with mail form
Message-Id: <5d2e6q$e16@fridge-nf0.shore.net>

Matt (matt@apc.net) wrote:

: on my home page i would like to put a simple mail form...
: however, my server wont let me access the CGI-BIN
: im trying to do this : 

Then the correct newsgroup to reference is comp.infosystems.www.authoring.cgi.
There *is* a solution to your problem on that newsgroup, or check the
Usenet archives for the above group at www.dejanews.com.

HTH!

--
N Patwardhan
nvp@shore.net
[news:alt.fan.jwz]


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

Date: Sun, 02 Feb 1997 16:43:32 +0100
From: "T. de Konink" <konink@telebyte.nl>
Subject: HELP: How to speed up Perl scripts ?
Message-Id: <32F4B624.67C5@telebyte.nl>

Hi,

I'm trying to speed up my Perl scripts under Linux. For that problem the
following questions:

1) Can I turn an perl script into an executable in some way ?
2) Is there something of an utility to transform Perl-scripts into
C-code or object-code ?

Thanks allready for answering my questions,

Thomas de Konink
mailto:konink@telebyte.nl


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

Date: Sun, 2 Feb 1997 16:08:03 GMT
From: neilb@cre.canon.co.uk (Neil Bowers)
Subject: Re: HELP: How to speed up Perl scripts ?
Message-Id: <E4zGtF.D6n@canon.co.uk>

In comp.lang.perl.misc T. de Konink <konink@telebyte.nl> wrote:
: I'm trying to speed up my Perl scripts under Linux. For that problem the
: following questions:
:
: 1) Can I turn an perl script into an executable in some way ?
: 2) Is there something of an utility to transform Perl-scripts into
: C-code or object-code ?

Malcolm Beattie is working on a Perl Compiler, which is currently
available as a third alpha release. You can find out more at:

	http://users.ox.ac.uk/~mbeattie/perl.html

For general hints on improving performance of Perl code, a good
source for tips is the Camel book, second edition. Particularly
the section in Chapter 8, titled "Time Efficiency" (page 537).

And finally, if you're doing lots of regex work, you are using
the /o where appropriate aren't you? :-)

hope this helps,
neilb
--
If you can spend a perfectly useless afternoon in a perfectly useless manner,
you have learned how to live.				-- Lin Yutang


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

Date: 2 Feb 1997 16:14:28 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: HELP: How to speed up Perl scripts ?
Message-Id: <5d2eh4$e16@fridge-nf0.shore.net>

T. de Konink (konink@telebyte.nl) wrote:

: 1) Can I turn an perl script into an executable in some way ?

Yes.

: 2) Is there something of an utility to transform Perl-scripts into
: C-code or object-code ?

Yes.

There's a Perl compiler in Alpha that you might take a look at
(http://www.perl.com/perl/CPAN/) and follow the links to the
compiler.  You might also do a 'net search for 'Perl Compiler.'  :-)

--
N Patwardhan
nvp@shore.net
[news:alt.fan.jwz]


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

Date: 02 Feb 1997 18:42:59 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: Atul Awate <aawate@juno.com>
Subject: Re: How do I supply password??
Message-Id: <ORWANT.97Feb2134259@fahrenheit-451.media.mit.edu>


In article <32F26E37.BC9@juno.com> Atul Awate <aawate@juno.com> writes:

   I am logged in as user1 and executing a perl script.  There is a command
   in this script which I have to execute as user2.  So I want to do a 
	   'su - user2 "-c command"'
   But this asks for password of user2.  I want to give the password inside
   the script only so that it doesn't prompt me for the password.  Is this
   possible to be done with perl? How?

Don't use su.  Use $< and $> to set the userid.  Use getpwnam() to
find out the userid given the username.

-Jon

----------------
Jon Orwant
The Perl Journal
http://tpj.com/


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

Date: 02 Feb 1997 18:33:33 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: mpanfilo@mailbox.syr.edu
Subject: Re: Invoking Perl program
Message-Id: <ORWANT.97Feb2133333@fahrenheit-451.media.mit.edu>


mpanfilo@newstand.syr.edu (Maksym I  Panfilov) writes:

   From within Unix this Perl program runs. Tutorial says that when i click
   on a Perl's program link from a browser it should return appropriate
   information in correct HTML format directly to the browser. Unfortunately,
   after invoking the program via link I receive just a text of a program,
   not HTML formatted page. It should be noted that I made Perl's program
   executable.

Your web server needs to be told to think of the Perl program
as a CGI script, rather than as plain HTML.  This can happen
in lots of ways, most often by telling your server that any 
file ending in ".cgi" should be executed, or by telling your
server that everything in that directory is a CGI program.

-Jon

----------------
Jon Orwant
The Perl Journal
http://tpj.com/









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

Date: Sun, 02 Feb 1997 13:21:22 -0500
From: pudge@pcix.com (Chris Nandor)
Subject: Re: MacPerl FAQ?
Message-Id: <pudge-ya023480000202971321220001@news.idt.net>

In article <32F28786.4E06@orca.alaska.edu>, snsbg@orca.alaska.edu wrote:

# I'm a newer than newbie. I want to start learning Perl and have zero
# experience. My server is a Mac sans Unix. I've downloaded MacPerl5, but
# there is absolutely no documentation on how to install and setup the
# program. The MacPerl Primer at:
# 
# http://www.unimelb.edu.au/~ssilcot/macperl-primer/home.html
# 
# assumes the program has been installed and setup, so it's no help.

Well, there is nothing to installing it, really.  You just run the
installer program.  Boom!

Regardless, the FAQ is at:

http://err.ethz.ch/~neeri/macintosh/macfaq.html

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: Sun, 2 Feb 1997 18:03:53 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Need a way to calculate a random number between 1 and 20
Message-Id: <E4zM6H.4zn@world.std.com>

david@diablo.eimages.co.uk (David Cantrell) writes:

>aml@world.std.com (Andrew M. Langmead) wrote:
>>Every port of perl that I have seen includes the man pages.

>But my point was that 'perlfunc(1)' in meaningless.  Only those who
>are acquainted with Unix will understand.  This constant mentioning of
>'manpages' instead of the more meaningful 'documentation' is just
>another example of the Unix-centrism which is beginning to REALLY piss
>me off - almost as much as Windows-centrism or Mac-evangelism does.

1. Whether one says "perlfunc(1)", "the perlfunc man page", "the
perlfunc documentation", or just "look in perlfunc", it makes little
difference. If a perl programmer doesn't know about the file named
perlfunc (with perhaps some file extension), they are really missing
some of the basic tools they need to program in perl and should not be
posting questions here. I'm not saying they should have all the man
pages memorized. I'm not saying they even have to understand
everything that is in them. I'm just saying they have to know they
exist and are willing to try referencing them first. I can't imagine a
fledgling programmer seeing "perlfunc(1)" or "the perlfunc man page"
and making no connection between it the button labeled "perlfunc" on
their web browser. If they can't, they are missing other basic tools
that they need to program in perl.

2. Perl has strong roots in Unix, or as the book "Programming Perl"
puts it, "Perl is the portable distillation of UNIX culture".  People
who try to fight or ignore this unix-centrism of perl will be
continually frustrated by the language.

3. I have never posted or e-mailed a reply to a question in
comp.lang.perl.misc in which the author of the question asked me what
I meant by the perlfunc, perlre, perlref, or perlsec (or whatever) man
page. You seem to know what I mean. When I run into someone who is
really asking for my help, and really doesn't know what a man page is,
I'll consider rewording my responses.

-- 
Andrew Langmead


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

Date: Sun, 02 Feb 1997 13:00:16 -0500
From: pudge@pcix.com (Chris Nandor)
Subject: Re: Need a way to calculate a random number between 1 and 20
Message-Id: <pudge-ya023480000202971300160001@news.idt.net>

In article <5ctkrd$onv$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com (Tom
Christiansen) wrote:
# You'll notice, BTW, that "manpage" is glossed in the back of the Camel.

"Glossed"?  What does that mean?  No publishing-centric terms, please!!

He writes a book and thinks he can use fancy terminology ...  ;-)

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: Sun, 2 Feb 1997 08:20:21 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "D. M. Johnson" <ez045864@peseta.ucdavis.edu>
Subject: Re: Need help with variable manipulation
Message-Id: <Pine.GSO.3.95.970202081550.3750D-100000@linda.teleport.com>

On Sat, 1 Feb 1997, D. M. Johnson wrote:

> 1) If $name = randal, how can I reverse this.  I need to get
>    $name = ladnar 

Perl has a reverse function, documented in perlfunc(1). 

> 2) I need to spell check a word.  If I store "dog" into $word, how
>    can I spell check $word?

Perl doesn't have any built-in spell checking functions, but there are
several ways to do it. My choice would be to call an external spell
program, like spell or ispell on Unix-type systems. If you want to do the
check directly within Perl, you could use the contents of the Unix system
dictionary /usr/dict/words. On non-Unix systems, you may have more
difficulty, alas.

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Sun, 02 Feb 1997 13:05:04 -0500
From: pudge@pcix.com (Chris Nandor)
Subject: Re: New Group ideas: Splitting clpm
Message-Id: <pudge-ya023480000202971305040001@news.idt.net>

I don't know, I would like to see a comp.lang.perl.newbies group.

How about a comp.lang.perl.cgi group that does the following:

*moderated
*allows only one post a week, a FAQ saying "do not post here, post to the
CGI group ... "
*all posts sent there get autoreply saying "why did you post here, didn't
you read the FAQ???"

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: Sun, 2 Feb 1997 14:08:55 +0000
From: Andy Armstrong <andy@wonderworks.co.uk>
Subject: Possible bug -- should I try to isolate it?
Message-Id: <ouSAxTA3$J9yEwvq@wndrwrks.demon.co.uk>

I've recently been developing some code which did something like

   my $pos = pos $doc;

   # Do some munging around include m//g on $doc

   pos $doc = pos;

And found that Perl (NTPerl 5.001) was bombing on the assignment to pos.
Unfortunately the problem slipped away from me before I'd bothered to
take a copy of the afflicted code.

Q: Is this a known problem with 5.001? If so I won't bother to try and
isolate it again.

-- 
http://www.wonderworks.co.uk --> What's Wrong With Multimedia
Andy Armstrong, WonderWorks


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

Date: 02 Feb 1997 18:38:46 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: ceetm@cee.hw.ac.uk (Triantafyllos Marakis)
Subject: Re: Question
Message-Id: <ORWANT.97Feb2133846@fahrenheit-451.media.mit.edu>


ceetm@cee.hw.ac.uk (Triantafyllos Marakis) writes:

   Is it possible to query remotely a CGI script (A search engine CGI
   script) and get the results automatically on a file? Please email me
   if you have an answer for this problem, or you have any suggestions.

Two ways.  You can use Jeffrey Friedl's "webget" program, either
off his web page or the CPAN.  See http://www.perl.com/CPAN.

Or, use LWP (library...world wide web...perl), which will do this for
you, and oh so much more.  LWP is also on the CPAN, at
http://www.perl.com/CPAN/modules/by-module/LWP/.

    P.S. I have just starting programming with perl so please do not
    use extreme perl terminology.

I wonder what the most extreme Perl term is.  Perhaps "magic."

-Jon

----------------
Jon Orwant
The Perl Journal
http://tpj.com/


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

Date: Sun, 02 Feb 1997 13:23:26 -0500
From: pudge@pcix.com (Chris Nandor)
Subject: Re: Really, really BIG files with MacPerl
Message-Id: <pudge-ya023480000202971323260001@news.idt.net>

In article <32F3A155.886@fas.harvard.edu>, megason@fas.harvard.edu wrote:

# Hello all! I'm working on a project for which I'll need to be able
# process a really big file (3 GB). I've convinced my boss to buy a big
# hard drive, but I wanted to make sure that MacPerl and MacOS can handle
# a file that big so I don't look like a fool if it can't. 
# 
# Does anyone know if file pointers or anything else in MacPerl or MacOS
# max out at some point so that they can't handle a 3 GB file??

Try the MacPerl mailing list:

   http://err.ethz.ch/~neeri/macintosh/perl-qa.html

However, there are no built-in limitations to MacPerl.  You might be
limited by the memory partition given to MacPerl, but that shouldn't be a
problem.  I don't think you are planning on slurping the whole file into
RAM before you do work on it.

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: 2 Feb 1997 15:29:05 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: regex eats newline?
Message-Id: <slrn5f9chh.bo6.dave@fast.thomases.com>

On Sun, 02 Feb 1997 13:41:00 GMT, Frans Postma <F.Postma@inter.NL.net> wrote:
> Hi there,
> 
> I got a script which parses a standard mail-message header and
> extracts some components of it. Among other things it determines the
> subject (Subject: line).
> 
> Problems arise when the subject is empty or only filled with spaces.
> Example as short as I could:
> 
> #!perl
> $x='Subject:
> To: bla@abla
> Date: Sat 01-02-1997';
> $x=~s/Subject:\s*([^\n]*?)\s*\n/Subject: $1\n/im;
> print $x;
> __END__
> 
> Output of this is:
> Subject: To bla@abla
> Date: Sat 01-02-1997
> 
> Question: why does the regexp on $x eat the line on the Subject line?
> $1 should be empty in the s//m in this case but for some reason it
> grabs the next line too, which it shouldn't 'cos I specificly exclude
> newlines (\n)....

Its because \s _includes_ newlines. Your regex works if you change it to

   $x=~s/Subject:[ \t]*([^\n]*?)[ \t]*\n/Subject: $1\n/im;


Regards

Dave


-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Sun, 2 Feb 1997 07:04:25 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: saving problem
Message-Id: <pc32d5.uk.ln@localhost>

A MAGIC STORE (max@amagicstore.com) wrote:
: Hi everyone !
: My question is this: I programed a script in Perl using Notepad(win95)
: and saved it as text document with .pl extension, but when I uploaded it
: to my unix server and  execute it, it didn't work.
: My server checked out the perl program and said that there are ^M s at
  ^^^^^^^^^                                  ^^^^^^^^^^^^^^^^^^^^^^

Your 'server' (I assume you mean your ISP) is clue deficient if
they didn't know immediately what this is...

Consider changing when your obligation to them is up ;-)


: the end of each line of program, like I had saved it as a WP document.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Sun, 2 Feb 1997 07:12:19 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: sorting multidimensional arrays in perl?
Message-Id: <jr32d5.ko.ln@localhost>

Apple-O (appleo@raven.cybercomm.net) wrote:
: Does perl support multidimensional arrays? 
                    ^^^^^^^^^^^^^^^^

Yes.

Included with the perl distribution are a bunch of files with a '.pod'
(Plain Old Documentation) filename extension.

grep multidimensional *.pod

finds 6 hits.



As I'm sure you are a good 'net citizen, you have undoubtedly already
done the above before posting your question to thousands of computers
around the entire Earth.

What part of the explanation given there are you unclear on?


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 02 Feb 1997 09:17:36 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: bet@nospam.interactive.net (Bennett Todd)
Subject: Re: space stripping
Message-Id: <8csp3f5gin.fsf@gadget.cscaper.com>


[slightly revised, now that I've had my caffiene...]

>>>>> "Bennett" == Bennett Todd <bet@nospam.interactive.net> writes:

Bennett> I tend to use, as an idiom,

Bennett> 	s/#.*$//;s/\s+$//;next if /^$/;s/^\s+//;s/\s+/ /g;

Bennett> which canonicalizes whitespace and strips #-to-eol
Bennett> comments. The one thing I haven't quite settled on is what's
Bennett> the best way to do "\" line continuation --- when the last
Bennett> character is "\", extend the line. I would love to duplicate
Bennett> the syntax that shells use, and I also want to report error
Bennett> messages with original input line numbers when I see a syntax
Bennett> error in the file, and I haven't found an idiom for input
Bennett> thagomizing that does all these perfectly. Oh well, perhaps
Bennett> perfection is not for this life.

>From one of the slides in my class:

	while (<>) {
		s/#.*//; # kill comments
		next if /^\s*$/; # skip blanks
		redo if s/\s*\\\s*\n$/<>/e; # fold \
		s/^\s+//; # kill prefix whitespace
		s/\s+$//; # and suffix whitespace
		...
	}

Yours, for free. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 576 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 2 Feb 1997 16:14:43 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: space stripping
Message-Id: <5d2ehj$gui$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Randal Schwartz <merlyn@stonehenge.com> writes:
:From one of the slides in my class:
:	while (<>) {
:		s/#.*//; # kill comments
:		next if /^\s*$/; # skip blanks
:		redo if s/\s*\\\s*\n$/<>/e; # fold \
:		s/^\s*//; # kill prefix whitespace
:		s/\s*$//; # and suffix whitespace
:		...
:	}
:
:Yours, for free. :-)

I think I would much prefer 

    s/^\s+//; # kill prefix whitespace
    s/\s+$//; # and suffix whitespace

Go read jfriedl's book for why. :-)

--tom
-- 
Tom Christiansen      Perl Consultant, Gamer, Hiker      tchrist@mox.perl.com
    > This made me wonder, suddenly: can telnet be written in perl?
    Of course it can be written in Perl.  Now if you'd said nroff, 
    that would be more challenging...   --Larry Wall


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.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.

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 V7 Issue 883
*************************************

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