[25248] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7493 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 7 21:10:29 2004

Date: Tue, 7 Dec 2004 18:10:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 7 Dec 2004     Volume: 10 Number: 7493

Today's topics:
    Re: New comp.lang.perl.misc mirror site at lampforums.o <mcgucken@jollyroger.com>
    Re: New comp.lang.perl.misc mirror site at lampforums.o <comdog@panix.com>
    Re: New comp.lang.perl.misc mirror site at lampforums.o <spamtrap@dot-app.org>
    Re: New comp.lang.perl.misc mirror site at lampforums.o <jkeen_via_google@yahoo.com>
    Re: Obtaining length of binary string <ravi@none.nowhere.com>
        Paragraph separation for DOS files on Unix (Oliver Heidelbach)
    Re: Paragraph separation for DOS files on Unix <junk@blackwater-pacific.com>
    Re: Paragraph separation for DOS files on Unix <ahamm@mail.com>
    Re: perl port to my m68k calculator <spamtrap@dot-app.org>
    Re: perl port to my m68k calculator <spamtrap@dot-app.org>
    Re: perl port to my m68k calculator <ahamm@mail.com>
    Re: PerlCom Replacements <ahamm@mail.com>
    Re: RegExp Help <ahamm@mail.com>
    Re: RegExp Help <ahamm@mail.com>
    Re: RegExp Help <sbryce@scottbryce.com>
    Re: RegExp Help <ahamm@mail.com>
    Re: RegExp Help <ahamm@mail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 7 Dec 2004 15:14:03 -0500
From: astro <mcgucken@jollyroger.com>
Subject: Re: New comp.lang.perl.misc mirror site at lampforums.org
Message-Id: <astro.1gwum4@lampforums.org>


Thanks Jim,

We actually had a debate here regarding that--I thought it was Perl,
but then, somebody convinced me it was an acronym and thus should be
PERL, like NASA.

Best,

Elliot


-- 
astro
------------------------------------------------------------------------
astro's Profile: http://lampforums.org/member.php?userid=1
View this thread: http://lampforums.org/showthread.php?t=92721



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

Date: Tue, 07 Dec 2004 17:15:10 -0600
From: brian d foy <comdog@panix.com>
To: astro <mcgucken@jollyroger.com>
Subject: Re: New comp.lang.perl.misc mirror site at lampforums.org
Message-Id: <071220041715100024%comdog@panix.com>

[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

In article <astro.1gwum4@lampforums.org>, astro
<mcgucken@jollyroger.com> wrote:

> We actually had a debate here regarding that--I thought it was Perl,
but
> then, somebody convinced me it was an acronym and thus should be
PERL, like
> NASA.

Perl is not an acronym.  It even says so in the docs.

   http://faq.perl.org/perlfaq1.html#What_s_the_differenc

-- 
brian d foy, comdog@panix.com
Subscribe to The Perl Review: http://www.theperlreview.com


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

Date: Tue, 07 Dec 2004 18:22:46 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: New comp.lang.perl.misc mirror site at lampforums.org
Message-Id: <bK2dnVhGdKvapivcRVn-2Q@adelphia.com>

astro wrote:

> We actually had a debate here regarding that--I thought it was Perl,

What's to debate? The docs are clear - it's Perl for the language and 
perl for the interpreter.

> but then, somebody convinced me

The moral of the story: Read the docs for yourself, don't just listen to 
random strangers on usenet. That includes me. :-)

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Wed, 08 Dec 2004 01:37:12 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: New comp.lang.perl.misc mirror site at lampforums.org
Message-Id: <cVstd.4133$4Y5.3482@trndny05>

astro wrote:

> Thanks Jim,
> 
> We actually had a debate here regarding that--I thought it was Perl,
> but then, somebody convinced me it was an acronym and thus should be
> PERL, like NASA.
> 

It's more a retronym, i.e., the name Perl came first, and then came 
various attempts to figure out if that was an abbreviation for 
something.  Most serious attempt:  Practical Extraction and Report 
Language.  The less serious attempts are easily googled for.

The binary executable for the language, at least in a *nix environment, 
is 'perl' -- all lower-case.  The language is initial caps 'Perl', just 
like 'Linux', 'Python', but not like 'PHP' or 'HTML'.

jimk


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

Date: Tue, 7 Dec 2004 16:46:29 -0700
From: Perl User <ravi@none.nowhere.com>
Subject: Re: Obtaining length of binary string
Message-Id: <Pine.OSF.4.60.0412071645460.967403@manta.eller.arizona.edu>


On Fri, 3 Dec 2004, Ben Morrow wrote:
>
> Quoth Perl User <ravi@none.nowhere.com>:
>> Hi,
>>  	Here's my problem:
>>
>> I read encrypted data from a server and save it in a variable. Now, I need
>> to send this back to the server along with a number that tells how many
>> bytes long the binary data is.
>>
>> I've tried
>> $x = read_data_from_server($args);
>> $y = length $x;
>> send_data_to_server($x,$y);
>>
>> I am not sure if the length function is the right way to count the number
>> of bytes in the string $x. Can someone please show me how to do this?
>
> It is, provided you've told perl that your data is binary not textual.
> Make sure you use binmode on the socket filehandle.

Thanks Ben and everyone else for helping me out! I realized that I was not 
using the "use bytes" pragma at one particular place in the program, and 
this was causing it to fail.




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

Date: 7 Dec 2004 23:14:16 GMT
From: ohei@nospam.snafu.de (Oliver Heidelbach)
Subject: Paragraph separation for DOS files on Unix
Message-Id: <uYfUC0dMvCdn-pn2-BCbrjG2IHEUd@ohei.snafu.de>

Hi,

is there any way to get Unix Perl to work on DOS files (CRLF) when
reading in paragraphs and without to convert the line endings
before processing the file?

The usual 

$/ = "";
@paras = split(/""/,$_);

works fine for DOS files on systems with DOS format and DOS-aware
Perl and for Unix files on Unix systems and Unix-aware Perl.

However, it does not work for DOS files on Unix systems. I tried
everything which came to my mind, but nothing really works.

e.g.:
$/ = "^\r*$";
@paras = split(/"^\r*$"/,$_);

$/ = "^\r\n$";
@paras = split(/"^\r\n"/,$_);

$/ = "^\s*$";
@paras = split(/"^\s*$"/,$_);

I am regularly shifting DOS formatted files to Unix for
further processing and having to convert those before
touching with Perl is a major annoyance.

If the paragraph separation cannot be done on that format
on Unix properly, is there any easy way to slurp in the file,
convert it in memory and then process the data as if it were
read from a file directly?

Thanks for any help with this.

Mit freundlichen Gruessen
Oliver Heidelbach

-- 
Internet: ohei@snafu.de
WWW: http://home.snafu.de/ohei



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

Date: Tue, 07 Dec 2004 15:42:18 -0800
From: Steve May <junk@blackwater-pacific.com>
Subject: Re: Paragraph separation for DOS files on Unix
Message-Id: <10rcfni295aku51@corp.supernews.com>

Oliver Heidelbach wrote:

> Hi,
> 
> is there any way to get Unix Perl to work on DOS files (CRLF) when
> reading in paragraphs and without to convert the line endings
> before processing the file?
> 
> The usual 
> 
> $/ = "";
> @paras = split(/""/,$_);
> 
> works fine for DOS files on systems with DOS format and DOS-aware
> Perl and for Unix files on Unix systems and Unix-aware Perl.
> 
> However, it does not work for DOS files on Unix systems. I tried
> everything which came to my mind, but nothing really works.
> 
> e.g.:
> $/ = "^\r*$";
> @paras = split(/"^\r*$"/,$_);
> 
> $/ = "^\r\n$";
> @paras = split(/"^\r\n"/,$_);
> 
> $/ = "^\s*$";
> @paras = split(/"^\s*$"/,$_);
> 
> I am regularly shifting DOS formatted files to Unix for
> further processing and having to convert those before
> touching with Perl is a major annoyance.
> 
> If the paragraph separation cannot be done on that format
> on Unix properly, is there any easy way to slurp in the file,
> convert it in memory and then process the data as if it were
> read from a file directly?
> 
> Thanks for any help with this.
> 
> Mit freundlichen Gruessen
> Oliver Heidelbach
> 

carriage return / line feed (octal)

# untested
my $crlf = "\015\012";

my @lines = split /$crlf/, $_;


\s


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

Date: Wed, 8 Dec 2004 12:55:07 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: Paragraph separation for DOS files on Unix
Message-Id: <31n57tF3cvdt3U1@individual.net>

Steve May wrote:
> Oliver Heidelbach wrote:
>
>> Hi,
>>
>> is there any way to get Unix Perl to work on DOS files (CRLF) when
>> reading in paragraphs and without to convert the line endings
>> before processing the file?
>>
>> The usual
>>
>> $/ = "";
>> @paras = split(/""/,$_);
>>
>> works fine for DOS files on systems with DOS format and DOS-aware
>> Perl and for Unix files on Unix systems and Unix-aware Perl.
>>
>> However, it does not work for DOS files on Unix systems. I tried
>> everything which came to my mind, but nothing really works.

Assuming you are using a sufficiently modern version of Perl, have a fresh
look at the "IO layers" or "disciplines" of the open call. I'm actually
struggling to find a suitable perldoc section (someone else will surely
post one), but if you have the 3rd edition of the Camel book, look at
pages 754,755 which actually appears to show almost exactly what you are
trying to do

    open FH, "<:para:crlf", $filename

:para means put the file into paragraph mode, :crlf means to handle CR/LF
line terminators on your behalf.




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

Date: Tue, 07 Dec 2004 18:23:42 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl port to my m68k calculator
Message-Id: <bK2dnVtGdKvipivcRVn-2Q@adelphia.com>

bulk88@hotmail.com wrote:

> Can someone please port perl to my 12 mhz Motorola 68000 CPU (same as
> in apples) Texas Instruments 89 graphing calculator?

I'd be happy to. What are you offering in payment?

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Tue, 07 Dec 2004 18:28:38 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: perl port to my m68k calculator
Message-Id: <LvydnYEO6bU6oSvcRVn-jA@adelphia.com>

bulk88@hotmail.com wrote:

> Motorola 68000 CPU (same as in apples)

(Double-take)

Same as in Apples? As in, Macintoshes? Macs haven't used 68k chips for 
ten years. Where have you been???

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Wed, 8 Dec 2004 12:44:28 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: perl port to my m68k calculator
Message-Id: <31n4jtF3edf1aU1@individual.net>

bulk88@hotmail.com wrote:
> Can someone please port perl to my 12 mhz Motorola 68000 CPU (same as
> in apples) Texas Instruments 89 graphing calculator?
>
> There is a C compiler available for the calculator. I would like to be
> able to run perl on it because, the BASIC of the calculator is feature
> limited, and not good at text processing, or dealing with strings. And
> there are no regular expressions and all the flexibility and glue-ness
> of Perl. And C isnt so good at strings either, and too much risk of
> severe crashing. I've written a couple math programs in Perl, which
> are more text manipulation than math, and it would be wonderful if I
> could use them on my calculator.

Holy crap. How much memory? Enough for an executable that's maybe 1.5Mb in
size, even before you start to deal with your data?

This has to be a joke, surely. If you are serious, you'd have more luck
maybe with FORTH, although that can be crap with strings. Perhaps LISP -
that's been around forever and used to fit into a tiny footprint. Both
these languages are brain-numbing to use, however (imho)

Maybe you should go looking for public source to another Tiny BASIC which
supports much better string handling and upload that.

I'd please like someone to Port Algol-68 to my Casio PB-100 pocket
calculator. It's got a full keyboard and some non-ASCII symbols!

Just for the sake of it, what are the other specs for this calculator?
Memory, disk, amount of EPROM....




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

Date: Wed, 8 Dec 2004 10:55:01 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: PerlCom Replacements
Message-Id: <31mu6nF3doe5bU1@individual.net>

VBSome wrote:
> PerlCom used to be the tool to expose Perl to COM.
> ActiveState no longer maintains or sells it.
>
> I have talked to ActiveState Tech Support and they say the only other
> option I have is to use PerlCtrl, which converts a perl script to an
> ActiveX control. I have about a 100 scripts that change almost
> weekly. I really do not want to have to create a new control every
> time I need to make a minor change to one of my scripts.
>
> Are there any replacements out there for PerlCom ??

Are there no modules on CPAN? I have never used COM but surely someone
else has independently made a tool.

Was PerlCom based on an open source effort, or was it proprietry from
Active State? If open source, how do you feel about building it yourself
from the (presumably) free source?




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

Date: Wed, 8 Dec 2004 10:29:08 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: RegExp Help
Message-Id: <31msm7F3bs7osU1@individual.net>

Scott Bryce wrote:
> BigDaDDY wrote:
>> Andrew,
>>
>> My bad..I did want 25.010 to be converted to 25.01.  Nice catch.
>>
>> How does this change the regexp you provided?
>
> Is there a reason why you insist on using a regex for a task that does
> not require one?

My guess is that he wants to retain the data in the original string;
perhaps massaging and cleaning up a report from some other external source
that he may not be able to fix.




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

Date: Wed, 8 Dec 2004 10:36:46 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: RegExp Help
Message-Id: <31mt4hF3cgd84U1@individual.net>

BigDaDDY wrote:
> Andrew,
>
> My bad..I did want 25.010 to be converted to 25.01.  Nice catch.
>
> How does this change the regexp you provided?

ok - welll, the way I think about it;

we want a string of zero's followed by a non-digit.

Adding in the recognition of the optional leading dot; well, it's an
optional leading dot! So the pattern starts to look like

    (\.?0*)(?!\d)

the negative lookahead should ensure that this is recognised only at the
tail end of a number.

However, if there are any integers in the listing - ie without the dot,
then they might be destroyed; for example 100 would be converted to 1

If that is a risk; it will probably get much uglier. If it's not a
problem, I'll save time and not think about it unless you say it's needed.
Could get interesting solving that one and still keep it elegant.




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

Date: Tue, 07 Dec 2004 17:32:10 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: RegExp Help
Message-Id: <n5idnYLlW94X1ivcRVn-sg@comcast.com>

Andrew Hamm wrote:

> My guess is that he wants to retain the data in the original string;
> perhaps massaging and cleaning up a report from some other external source
> that he may not be able to fix.

That still wouldn't require a regex.

my $var_1 = '2.0';
my $var_2 = $var_1 + 0;

Use $var_2 in the report, and you still have the original data in $var_1.



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

Date: Wed, 8 Dec 2004 12:36:09 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: RegExp Help
Message-Id: <31n44cF3dl3e4U1@individual.net>

Scott Bryce wrote:
>
> That still wouldn't require a regex.
>
> my $var_1 = '2.0';
> my $var_2 = $var_1 + 0;
>
> Use $var_2 in the report, and you still have the original data in
> $var_1.

Indigo5 submitted this data

> 25.010      36.5     20.00
> 22.3          19.       35.

so that looks like a pre-existing text file to me. That's why I think it's
too late to perform a fix where you suggest. Still, only Indigo knows for
sure, and it would be nice if Indigo could satisfy our curiosity with a
bit of info about where it's coming from - if you think it's important
enough to clear up. Otherwise assumptions rule the day.

If the task is a report massage then (s)he is not in control of the code
generating it (at a guess).  If (s)he is writing the original text file
then of course fixing the source of the text files is more appropriate.




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

Date: Wed, 8 Dec 2004 12:37:30 +1100
From: "Andrew Hamm" <ahamm@mail.com>
Subject: Re: RegExp Help
Message-Id: <31n46sF3bqvcuU1@individual.net>

Andrew Hamm wrote:
>
> If the task is a report massage then (s)he is not in control of the

hmm - other reply was handled "BigDaddy" so I guess Indigo5 aka Big Daddy
is indeed a he.




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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

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

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


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


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