[10042] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3635 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 4 12:06:00 1998

Date: Fri, 4 Sep 98 09:01:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 4 Sep 1998     Volume: 8 Number: 3635

Today's topics:
    Re: Perl & Java - differences and uses <->
    Re: Perl & Java - differences and uses (Robert McDermid)
        perl script to binary? rdk@my-dejanews.com
        Precompiled perl for solaris 2.5? (Philip Le Riche)
    Re: Precompiled perl for solaris 2.5? <eashton@bbnplanet.com>
        Problems with large numbers <clad@chevron.com>
    Re: Q: symlink under NT possible? scott@softbase.com
        Regexp to toggle a part of a string <jwagner@digilog.de>
    Re: Regexp to toggle a part of a string (Larry Rosler)
    Re: Regexp to toggle a part of a string <uri@sysarch.com>
    Re: Regexp to toggle a part of a string (Larry Rosler)
    Re: Regexp to toggle a part of a string (Andrew M. Langmead)
    Re: Removing comments from C files ? <jwagner@digilog.de>
        Why does 'lynx' in perl script fail on some servers? <lee@nospam.dvd-debate.com>
        Win32 PRK: PerlCOM example from C++? scott@softbase.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 4 Sep 1998 12:50:16 +0100
From: "Jim" <->
Subject: Re: Perl & Java - differences and uses
Message-Id: <35efe73a.0@news.netcom.co.uk>

Thanks to all for your input. It seems that it is worth learning both in
time, since I am already doing a course on C++ so the transition to java
shouldn't be that difficult and I'm pretty handy at Perl already.

I know my question was a bit provocative but I stated in the subject that I
was looking for the "differences and uses" and was also careful to make the
subject "Perl & Java" rather than "Perl V Java".




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

Date: 4 Sep 1998 15:32:51 GMT
From: mcdermid@hcl.com (Robert McDermid)
Subject: Re: Perl & Java - differences and uses
Message-Id: <6sp173$jda$6@nntp2.ba.best.com>

In message <35efe73a.0@news.netcom.co.uk> - "Jim" <->Fri, 4 Sep 1998 12:50:16
+0100 writes:
:>
:>Thanks to all for your input. It seems that it is worth learning both in
:>time, since I am already doing a course on C++ so the transition to java
:>shouldn't be that difficult and I'm pretty handy at Perl already.
:>
:>I know my question was a bit provocative but I stated in the subject that I
:>was looking for the "differences and uses" and was also careful to make the
:>subject "Perl & Java" rather than "Perl V Java".
:>

You might also consider looking into the Python language.  It is
generally useful for all the same things as Perl is, and while not
quite as wide-spread is well on it's way.  It also, IMHO, produces
much more readable and maintainable code than Perl, which I think
most people (except for Unix-heads who _like_ obscure syntax) would
agree is Perl's biggest weakness.  Best of all, Python has an
implementation in Java now, which means you can run it on any machine
that has a VM and access all of the Java classes, which means you
can get the best of both worlds with it.

-- Rob

==============================================================
Rob McDermid           Hummingbird Communications Ltd.
                       All opinions expressed are my own.
SPAM CONTROL:  Remove the dots from address before e-mailing
==============================================================



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

Date: Fri, 04 Sep 1998 14:03:20 GMT
From: rdk@my-dejanews.com
Subject: perl script to binary?
Message-Id: <6sorv8$neu$1@nnrp1.dejanews.com>

Hi!

Ive written a few perl scripts that I would like to distribute, at no charge,
but was hoping to convert them to a single binary.  Reason being that
the scripts include/use libraries, etc. and asking users to go fetch
and install various libraries is a bit beyond their technical capabilities.

Is such a transmorgification possible?

Please reply via email if possible.

Thanks,

Bobby

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 4 Sep 1998 14:32:02 GMT
From: pleriche@PROBLEM_WITH_INEWS_GATEWAY_FILE (Philip Le Riche)
Subject: Precompiled perl for solaris 2.5?
Message-Id: <6sotl2$puk2@mailnews.uk03.bull.co.uk>

Can anyone point me to (or send me) a precompiled version of Perl5 for
Solaris 2.5 please? I don't seem to have a dev system.

Thanx - Philip
--
=============================================================================
Philip Le Riche                               Voice: +44 1442 884390
(Malgre son nom, ce brave homme               Fax:   +44 1442 884854
 ne parle pas Francais)                       Email: pleriche@uk03.bull.co.uk
=============================================================================


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

Date: Fri, 04 Sep 1998 15:26:04 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Precompiled perl for solaris 2.5?
Message-Id: <35F00436.D0FACD45@bbnplanet.com>

> Can anyone point me to (or send me) a precompiled version of Perl5 for
> Solaris 2.5 please? I don't seem to have a dev system.

http://smc.vnet.net/solaris.html

e.


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

Date: Fri, 04 Sep 1998 09:57:09 -0500
From: Eric Ladner <clad@chevron.com>
Subject: Problems with large numbers
Message-Id: <35EFFFC5.6A7F8556@chevron.com>

This works:

$n = rand(2**53);
print "$n\n";

This doesn't:

$n = rand(2**53);
printf "%016d\n", $n

I assume it has something to do with the size of the number and that 
the printf is just a call to the normal stdio version.

Is there a Perl way to print a formatted number that is that big?

Eric

================================================================
Eric Ladner              | HPUX Systems Admin, Oracle DBA    
Pascagoula Refinery      | Java Programmer, Perl scripter, C++
Chevron Products Company | programmer, etc., etc., etc.


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

Date: 4 Sep 1998 13:53:02 GMT
From: scott@softbase.com
Subject: Re: Q: symlink under NT possible?
Message-Id: <35eff0be.0@news.new-era.net>

Bernhard Ehrminger (bernhard@perm.geologie.uni-freiburg.de) wrote:
> I would like to know if symlink works under NT?

No, a UNIX symbolic link is not possible. You can use shortcuts,
which are kind of like symlinks.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Fri, 4 Sep 1998 15:04:01 +0200
From: "Joerg Wagner" <jwagner@digilog.de>
Subject: Regexp to toggle a part of a string
Message-Id: <e3VyFSA29GA.158@upnetnews05>

I4m rather new to Perl and working hard on learning to deal efficently with
regular expressions.
One thing I cannot figure out (even not when reading the faqs, news,
camelbook etc - HELP please!):

I want to change a line of text which looks like  /Status = (ON|OFF)/
where I want to toggle ON to OFF and vice versa. In other words I want to
replace ON by OFF and OFF by ON.
Can I do that in just _one_ regexp???

Please send my a copy of your answer by private email. Thanx.
Jvrg Wagner, DigiLog, Saarbr|cken
jwagner@digilog.de






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

Date: Fri, 4 Sep 1998 07:35:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regexp to toggle a part of a string
Message-Id: <MPG.10599a75564277a989824@nntp.hpl.hp.com>

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

In article <e3VyFSA29GA.158@upnetnews05> on Fri, 4 Sep 1998 15:04:01 
+0200, Joerg Wagner <jwagner@digilog.de> says...
 ... 
> I want to change a line of text which looks like  /Status = (ON|OFF)/
> where I want to toggle ON to OFF and vice versa. In other words I want to
> replace ON by OFF and OFF by ON.
> Can I do that in just _one_ regexp???

Because you can evaluate any expression in the substitution side, you can 
do just about anything using a regex.  Whether you *should* is a 
separate question. :-)  In this case,

s/(Status = O)(N|FF)/$1 . ($2 eq 'N' ? 'FF' : 'N')/e;

Feh!

> Please send my a copy of your answer by private email. Thanx.
> Jvrg Wagner, DigiLog, Saarbr|cken
> jwagner@digilog.de

No problem, as you didn't munge your email address.

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


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

Date: 04 Sep 1998 11:01:44 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regexp to toggle a part of a string
Message-Id: <x7r9xr2a7a.fsf@sysarch.com>

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

  LR> [Posted to comp.lang.perl.misc and copy mailed.]
  LR> In article <e3VyFSA29GA.158@upnetnews05> on Fri, 4 Sep 1998 15:04:01 
  LR> +0200, Joerg Wagner <jwagner@digilog.de> says...
  LR> ... 
  >> I want to change a line of text which looks like  /Status = (ON|OFF)/
  >> where I want to toggle ON to OFF and vice versa. In other words I want to
  >> replace ON by OFF and OFF by ON.
  >> Can I do that in just _one_ regexp???

  LR> s/(Status = O)(N|FF)/$1 . ($2 eq 'N' ? 'FF' : 'N')/e;

well, larry, i will have to try to trump you again. try this which uses
one less $ var and a couple of fewer chars. it might be faster since it
has one less grouping.

this uses 5.005's lookbehind zerowidth assertion. this is the first time
i have played with it and it is cool. it allows you to match before
something without grabbing it. look ahead assertions overlap the next
expression so they won't work here (i tried them first :-( )

<tested>


use 5.005 ;

s/(?<=Status = O)(N|FF)/$1 eq 'N' ? 'FF' : 'N'/e ;


uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 4 Sep 1998 08:25:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regexp to toggle a part of a string
Message-Id: <MPG.1059a65bac704e85989827@nntp.hpl.hp.com>

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

In article <x7r9xr2a7a.fsf@sysarch.com> on 04 Sep 1998 11:01:44 -0400, 
Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
 ...
>   LR> s/(Status = O)(N|FF)/$1 . ($2 eq 'N' ? 'FF' : 'N')/e;
> 
> well, larry, i will have to try to trump you again. try this which uses
> one less $ var and a couple of fewer chars. it might be faster since it
> has one less grouping.

We each could have saved chars by squeezing all that air out of the 
substitution expression.  Like a JAPH.  :-)

> this uses 5.005's lookbehind zerowidth assertion. this is the first time
> i have played with it and it is cool. it allows you to match before
> something without grabbing it. look ahead assertions overlap the next
> expression so they won't work here (i tried them first :-( )
> 
> <tested>
> 
> use 5.005 ;

OK, I will install 5.005 on my laptop so I can test stuff too.  But -- 
see a post from Zenin earlier today -- I think 'use 5.005;' solutions 
will have limited utility for a long while.

        New features.  The %FIELDS stuff didn't exist in 5.004*, and with
        5.005* being such a major pain to switch to safely (in large
        systems at least), 5.004 will be with us longer then 4*... :-(

> s/(?<=Status = O)(N|FF)/$1 eq 'N' ? 'FF' : 'N'/e ;

Yes, it is cool.

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


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

Date: Fri, 4 Sep 1998 15:32:37 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Regexp to toggle a part of a string
Message-Id: <Eyrn6D.9p@world.std.com>

"Joerg Wagner" <jwagner@digilog.de> writes:

>I want to change a line of text which looks like  /Status = (ON|OFF)/
>where I want to toggle ON to OFF and vice versa. In other words I want to
>replace ON by OFF and OFF by ON.
>Can I do that in just _one_ regexp???


For the changing a line if a file part, I want to direct you to the
section of the FAQ entry "How do I change one line in a file/delete a
line in a file/insert a line in the middle of a file/append to the
beginning of a file?"
<URL:http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq5.html
#How_do_I_change_one_line_in_a_fi>

Here is one idea for toggling between two values in a substitution
operator (which is what I think you meant by doing it in a regex, I
can't see how to do it with only a match operator (execpt I guess with
the new regular expression extentions in 5.005, you can probably do
just about anything.)) Use a hash to store what what the data is
supposed to toggle to, and use that data for the replacement.

%toggle = ( OFF => 'ON', ON => 'OFF'); 
  while(<>) {
  s/(Status = )(ON|OFF)/${1}$toggle{$2}/;
  print;
}

If the auxiliary hash is against the "only in a regex" requirement,
then take a look at that the /e modifier can do for you.


  s/(Status = )(ON|OFF)/$1 . (($2 eq 'ON') ? 'OFF' : 'ON')/e;
-- 
Andrew Langmead


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

Date: Fri, 4 Sep 1998 15:07:22 +0200
From: "Joerg Wagner" <jwagner@digilog.de>
Subject: Re: Removing comments from C files ?
Message-Id: <OlBI#TA29GA.227@upnetnews05>

Have a look at the perlfaq:

-------- snip -------------------------------
Question:
How do I use a regular expression to strip C style comments from a file?

   While this actually can be done, it's much harder than you'd think.
   For example, this one-liner

    perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c

   will work in many but not all cases. You see, it's too simple-minded
   for certain kinds of C programs, in particular, those with what appear
   to be comments in quoted strings. For that, you'd need something like
   this, created by Jeffrey Friedl:

    $/ = undef;
    $_ = <>;

s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|\n+|.[^/"'\\
]*)#$2#g;
    print;

   This could, of course, be more legibly written with the /x modifier,
   adding whitespace and comments.

-------- snap -------------------------------

Jvrg Wagner, DigiLog, Saarbr|cken
jwagner@digilog.de


asheikh@my-dejanews.com schrieb in Nachricht
<6solco$f4v$1@nnrp1.dejanews.com>...
>How do I remove comments from a C file using perl's pattern matching.
Please
>note that comments can span multiple lines. Here is some examples:
>
>/**** COMMENTS ****/
>    /****
>     **
>     ** COMMENTS
>     **
>     **
>     *****/
>/**
> **
> **
> **
> **/
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum




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

Date: Fri, 04 Sep 1998 15:16:32 +0100
From: L J Stoneman <lee@nospam.dvd-debate.com>
Subject: Why does 'lynx' in perl script fail on some servers?
Message-Id: <35EFF640.16002443@nospam.dvd-debate.com>

Hi,

I have a simple script which uses the text based web browser lynx to
retrieve the contents of another page and out put certain aspects of it.

All very simple and it works from both a command line and from two
servers I have tried it on.

It doesn't work on one other, however. It will run from the servers
command line, but not through a browser request. Debugging reveals that
the script runs but gets nothing back from the command:
$htmldoc= `lynx -source $url`;

I have tried to use the full path to lynx and taking a copy of it and
trying to execute that, but to no avail.

Not stricly perl related I know, but I don't know where else to ask.

Hope you can help,

Lee.
--
I Made This! --> The UK DVD Debate Website @ http://www.dvd-debate.com
lee at dvd-debate dot com




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

Date: 4 Sep 1998 13:52:11 GMT
From: scott@softbase.com
Subject: Win32 PRK: PerlCOM example from C++?
Message-Id: <35eff08b.0@news.new-era.net>

I am looking at using the PerlCOM object from C++. Does anyone
have an example of calling it from C++? I don't even see
a tbl file for it.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

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


Administrivia:

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

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


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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