[11381] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4981 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 11:37:43 1999

Date: Fri, 26 Feb 99 08:36:07 -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           Fri, 26 Feb 1999     Volume: 8 Number: 4981

Today's topics:
        Idiotic, but, how to View perldoc perlipc... <wfunk@dev.tivoli.com>
    Re: Idiotic, but, how to View perldoc perlipc... (Steve Linberg)
    Re: Idiotic, but, how to View perldoc perlipc... <wfunk@dev.tivoli.com>
    Re: Idiotic, but, how to View perldoc perlipc... <cassell@mail.cor.epa.gov>
    Re: Idiotic, but, how to View perldoc perlipc... (I R A Aggie)
    Re: Idiotic, but, how to View perldoc perlipc... (M.J.T. Guy)
        Include a perl program in to an other perl program? dragnovich@my-dejanews.com
    Re: Include a perl program in to an other perl program? (Clay Irving)
    Re: Include a perl program in to an other perl program? <jeffp@crusoe.net>
        Insert newline into long string (Sun Qinghe)
    Re: Insert newline into long string <Allan@Due.net>
        Installing new version over and old one... gelliott@tufts.edu
    Re: Installing new version over and old one... <palincss@his.com>
        Installing packages with ppm on Win32-ActiveState thst@my-dejanews.com
    Re: Installing packages with ppm on Win32-ActiveState dturley@pobox.com
    Re: Installing packages with ppm on Win32-ActiveState <tonylabb@infonline.net>
        IO::File <$fh> vs $fh->getline <jem@electriciti.com>
    Re: IO::File <$fh> vs $fh->getline (Ronald J Kimball)
    Re: IO::File <$fh> vs $fh->getline <uri@ibnets.com>
    Re: IO::File <$fh> vs $fh->getline (Abigail)
    Re: IO::File <$fh> vs $fh->getline <jem@electriciti.com>
    Re: IO::File <$fh> vs $fh->getline (Sean McAfee)
        Is there a module or perl script for "computer telephon <burkhard.kiesel@med.siemens.de>
        Is there a utility to convert ksh to perl? <alan@fullcompass.com>
    Re: Is there a utility to convert ksh to perl? <jglascoe@giss.nasa.gov>
        Keeping Variables local to object invocation not entire <dante@lorenso.com>
        Keeping Variables local to object invocation not entire <dante@lorenso.com>
    Re: Keeping Variables local to object invocation not en <tchrist@mox.perl.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 24 Feb 1999 10:35:46 -0600
From: "Wade T. Funk" <wfunk@dev.tivoli.com>
Subject: Idiotic, but, how to View perldoc perlipc...
Message-Id: <36D42A62.1ABBE56C@dev.tivoli.com>

How do I do this?  I type 'perldoc perlipc' and it gives me an
error such as:

"syntax error in file /data/perl5Tk/bin/perldoc at line 18, next token "="
Please use commas to separate fields in file /data/perl5Tk/bin/perldoc at line 8
6, next char ^?"

Thanks for the help,

Wade T. Funk


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

Date: Wed, 24 Feb 1999 15:11:05 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Idiotic, but, how to View perldoc perlipc...
Message-Id: <linberg-2402991511050001@ltl1.literacy.upenn.edu>

In article <36D42A62.1ABBE56C@dev.tivoli.com>, "Wade T. Funk"
<wfunk@dev.tivoli.com> wrote:

> How do I do this?

What is your OS, version of Perl, etc?

-- 
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>


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

Date: Wed, 24 Feb 1999 14:17:07 -0600
From: "Wade T. Funk" <wfunk@dev.tivoli.com>
Subject: Re: Idiotic, but, how to View perldoc perlipc...
Message-Id: <36D45E43.556A8932@dev.tivoli.com>

Solaris 2.6 & Perl 5.001.

wade


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

Date: Wed, 24 Feb 1999 14:20:39 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Idiotic, but, how to View perldoc perlipc...
Message-Id: <36D47B37.2319CBF2@mail.cor.epa.gov>

Wade T. Funk wrote:
> 
> Solaris 2.6 & Perl 5.001.
> 
> wade

Then it's easy.  From any shelltool or cmdtool window, type
 perldoc perldoc
and get the perldoc documentation in manpage format.  That will 
tell you most of what you need.  Then try these:

perldoc perlre
perdoc -f grep

Piece of cake.

P.S.  Upgrade that Perl when you can.  I'm using 5.004 on my 
Slowlaris box, but I *really*should* bug the sysadmins more...
:-)

David
-- 
David Cassell,OAO                  cassell@mail.cor.epa.gov
Senior Computing Specialist
mathematical statistician


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

Date: 24 Feb 1999 22:22:40 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Idiotic, but, how to View perldoc perlipc...
Message-Id: <slrn7d8v2b.eqg.fl_aggie@enso.coaps.fsu.edu>

On Wed, 24 Feb 1999 14:17:07 -0600, Wade T. Funk <wfunk@dev.tivoli.com> wrote:

+ Perl 5.001.

Upgrade. IIRC, that version is CERTifiably insecure. Go get 5.004_04, or
5.005* if you like bleeding ledge.

James


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

Date: 25 Feb 1999 17:02:05 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Idiotic, but, how to View perldoc perlipc...
Message-Id: <7b3vmd$ikc$1@pegasus.csx.cam.ac.uk>

Wade T. Funk <wfunk@dev.tivoli.com> wrote:
>How do I do this?  I type 'perldoc perlipc' and it gives me an
>error such as:
>
>"syntax error in file /data/perl5Tk/bin/perldoc at line 18, next token "="
>Please use commas to separate fields in file /data/perl5Tk/bin/perldoc at line 8
>6, next char ^?"

That's very similar to what I get when I feed perldoc to Perl 4.

Looks like your perl versions are mixed up, and the perl version named
in the #! line of the perldoc script isn't the one it should be.


Mike Guy


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

Date: Mon, 22 Feb 1999 19:51:01 GMT
From: dragnovich@my-dejanews.com
Subject: Include a perl program in to an other perl program?
Message-Id: <7ascf0$kf6$1@nnrp1.dejanews.com>

well, I have made MANY perl programs the most of then uses the same SUBs to
make the same things... but when I make a better routine I have to modify all
the programs... soo is there any way to make the same thing like C's "include
<mysubs.pl>;" command??

then I just have to modify 1 program

Regards.
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com

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


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

Date: 22 Feb 1999 16:35:39 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Include a perl program in to an other perl program?
Message-Id: <slrn7d3jda.8kj.clay@panix.com>

On Mon, 22 Feb 1999 19:51:01 GMT, 
dragnovich@my-dejanews.com <dragnovich@my-dejanews.com> wrote:

>well, I have made MANY perl programs the most of then uses the same SUBs to
>make the same things... but when I make a better routine I have to modify all
>the programs... soo is there any way to make the same thing like C's "include
><mysubs.pl>;" command??
>
>then I just have to modify 1 program

http://language.perl.com/newdocs/pod/perlfaq8.html
What's the difference between require and use?

-- 
Clay Irving <clay@panix.com>
He who desires, but acts not, breeds pestilence. 
  - William Blake 



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

Date: Mon, 22 Feb 1999 18:03:09 -0500
From: evil Japh <jeffp@crusoe.net>
Subject: Re: Include a perl program in to an other perl program?
Message-Id: <Pine.GSO.3.96.990222180055.19973A-100000@crusoe.crusoe.net>

> well, I have made MANY perl programs the most of then uses the same SUBs to
> make the same things... but when I make a better routine I have to modify all
> the programs... soo is there any way to make the same thing like C's "include
> <mysubs.pl>;" command??

You want to look at either require()ing the file, or making it into a
module.  Depending on namespace conflicts, a module may be better.  But
anyway, read up on:
	perlfunc (look for require)
	perlmod

These can be accessed on your system via:
	perldoc perlfunc
and
	perldoc perlmod

-- 
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
973-882-1022
www.crusoe.net



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

Date: Wed, 24 Feb 1999 21:50:34 GMT
From: sunq@ERE.UMontreal.CA (Sun Qinghe)
Subject: Insert newline into long string
Message-Id: <Ku_A2.944$Zp3.35516@carnaval.risq.qc.ca>

A few weeks I asked a question: how can I insert a newline at certain intervals
in a long string. One of your great guys replied: Use

$longstring =~ s/.{0,70}/$1\n/g;

That is rather good. But I met a new problem: sometimes it simply insert
a newline in the middle of a word. How can I avoid this ?

Any help will be appreciated !

Sun


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

Date: Wed, 24 Feb 1999 18:59:58 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: Insert newline into long string
Message-Id: <xo0B2.750$986.13298@nntp1.nac.net>

Sun Qinghe wrote in message ...
:A few weeks I asked a question: how can I insert a newline at certain
intervals
:in a long string. One of your great guys replied: Use
:$longstring =~ s/.{0,70}/$1\n/g;
:That is rather good. But I met a new problem: sometimes it simply insert
:a newline in the middle of a word. How can I avoid this ?
:Any help will be appreciated !


The short answer is modules are your friends, see Text::Wrap.

The long answer:  Once upon a time in this news group Tim Gim Yee said that a
cat walked across his keyboard and came up with:

sub linewrap {
    my $line = shift; defined $line or return '';
    my @data = split /\t/, $line;
    my $columns = shift || $columns;
    my $tabstop = shift || $tabstop;
    my $frag = '';
    my $col  = $columns - 1;

    for (@data) {
        $_ = "$frag$_";
        $frag = '';
        s/(.{1,$columns}$)|(.{1,$col}(?:\S\s+|-(?=\w)))|(.{$col})/
            $3 ? "$3-\n" :
            $2 ? "$2\n" :
            (($frag = $1), '')
        /ge;
        $frag .= (' ' x ($tabstop - length($frag) % $tabstop));
    }

    local $_ = join '', @data, $frag;
    s/\s+$//gm;
    return $_;
}

Pretty cool eh?.  Just to be pedantic it you use it like:
$string = "\txxxxxx ssssssss ddddddddddds ssssssssssss eeeeeeeeee
rrrrrrrrrrrrr eeeeeeeeeeeeees   rrrrrrrrr rrrrrrrrss   rrrrrrrrr ssssssssss
ddddd";

$columns = 70;
$tabstop = 5;
$out = linewrap($string);
print $out;

HTH

AmD
--
$email{'Allan M. Due'} =' Allan@Due.net '
--random quote--
As far as the laws of mathematics refer to reality, they are not
certain; as far as they are certain, they do not refer to reality.
  Albert Einstein





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

Date: Tue, 23 Feb 1999 23:44:20 GMT
From: gelliott@tufts.edu
Subject: Installing new version over and old one...
Message-Id: <7avegj$a21$1@nnrp1.dejanews.com>

I have a red hat 5.1 system, and I just built and installed perl 5.00502 in
/usr, where the red hat rpm was installed. It seems like both versions are
still there, but it looks like the newer one is being used. Is there any
reason to keep the old rpm around, or can I just remove it and keep using the
new perl as normal? Thanks,

gary

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


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

Date: Tue, 23 Feb 1999 19:50:20 -0500
From: Steve Palincsar <palincss@his.com>
Subject: Re: Installing new version over and old one...
Message-Id: <36D34CCC.A3DDEAAC@his.com>

My system's also RH5.1, and about two weeks ago I did exactly
what
you did so that I could experiment with Perl Tk.  Everything was
fine until I tried to use Apache in localhost mode, and found
it wasn't starting because it wanted 5.004.  I ended up
reinstalling
5.004 from the distro CD, but monkeying with my path so that
5.005 would be found first.

gelliott@tufts.edu wrote:
> 
> I have a red hat 5.1 system, and I just built and installed perl 5.00502 in
> /usr, where the red hat rpm was installed. It seems like both versions are
> still there, but it looks like the newer one is being used. Is there any
> reason to keep the old rpm around, or can I just remove it and keep using the
> new perl as normal? Thanks,
> 
> gary
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


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

Date: Thu, 25 Feb 1999 13:50:46 GMT
From: thst@my-dejanews.com
Subject: Installing packages with ppm on Win32-ActiveState
Message-Id: <7b3kfj$pqc$1@nnrp1.dejanews.com>

When I try to install one of the perl packages on my well running system
(V50700,ActiveState, WInNT4.0) with
ppm install Date      or
ppm install PGP            or
ppm install Date       or
 ....
the command prompt shows always the error message:
Error installling package 'Date': Could not locate a PPD file for package Date

What am I doing wrong ?`

bye

Thomas


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


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

Date: Thu, 25 Feb 1999 15:39:14 GMT
From: dturley@pobox.com
To: thst@my-dejanews.com
Subject: Re: Installing packages with ppm on Win32-ActiveState
Message-Id: <7b3qr1$vqn$1@nnrp1.dejanews.com>

In article <7b3kfj$pqc$1@nnrp1.dejanews.com>,
  thst@my-dejanews.com wrote:
> When I try to install one of the perl packages on my well running system
> (V50700,ActiveState, WInNT4.0) with
> ppm install Date      or

> the command prompt shows always the error message:
> Error installling package 'Date': Could not locate a PPD file for package Date
>
> What am I doing wrong ?`

You aren't using a valid package name. You can't install what doesn't exist.

go to http://www.ActiveState.com/packages/default.prk?list=1 for alist a
packages that are available.
--

____________________________________
David Turley

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


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

Date: Thu, 25 Feb 1999 13:48:26 -0500
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: Installing packages with ppm on Win32-ActiveState
Message-Id: <36D59AFA.70AAD85D@infonline.net>

You can also do: ppm search package-name. This will list the available
package names if they exist.

thst@my-dejanews.com wrote:
> 
> When I try to install one of the perl packages on my well running system
> (V50700,ActiveState, WInNT4.0) with
> ppm install Date      or
> ppm install PGP            or
> ppm install Date       or
> ....
> the command prompt shows always the error message:
> Error installling package 'Date': Could not locate a PPD file for package Date
> 
> What am I doing wrong ?`
> 
> bye
> 
> Thomas
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

-- 
			****************************************
			*    Tony Labbiento                    *
			*    Infinity Online, Inc.             *
			****************************************


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

Date: Thu, 25 Feb 1999 13:10:09 -0800
From: John Mendenhall <jem@electriciti.com>
Subject: IO::File <$fh> vs $fh->getline
Message-Id: <36D5BC31.41C67EA6@electriciti.com>

Perl Experts (or just about anyone that can tell me what I am
doing wrong),

I am working on a system that opens multiple files, saving the
open file handles in a hash to be used later.  However, when
retrieved later, it does not work using <$fh> in all attempts
after the first.  The use of $fh->getline works every time.

I would like to know why.

I have created a small code sample that exhibits the same
problem as that in the larger system.  I have included code
snippet (approx 1200 bytes) below.  Also, just so it is known,
my versions are listed below.

Please let me know if you need any additional information.
Also, please be gentle if it something stupid (as it usually
is after staring at this code for hours on end).

Thanks.

JohnM




:::::
Versions
:::::

Perl: 5.004_04
IO::File: 1.07



:::::
Output using $fh->getline
:::::

1 $line = 'line1'
2 $line = 'line2'
3 $line = 'line3'

:::::
Output using <$fh>
:::::

1 $line = 'line1'
Use of uninitialized value at testopen3.pl line 38, <GEN0> chunk 7.
Use of uninitialized value at testopen3.pl line 39, <GEN0> chunk 7.
2 $line = ''
Use of uninitialized value at testopen3.pl line 48, <GEN0> chunk 7.
Use of uninitialized value at testopen3.pl line 49, <GEN0> chunk 7.
3 $line = ''



::::::::::::::
testopen3.file
::::::::::::::
line1
line2
line3
line4
line5
line6
line7
::::::::::::::
testopen3.pl
::::::::::::::
#!/usr/local/bin/perl -w
use strict;
use IO::File ();
{
  my ($template) = "testopen3.file";
  my (@filehandle);
  my (%filehandle);

  # open template file
  {
    # declare, initialize my file handle
    my ($fh) = ('');
    # setup file handle symbol
    $fh = IO::File->new();
    # get a unique identifier for this file
    my ($fileident) = join (':', (stat($template))[0,1]);
    # attempt to open the template
    $fh->open($template) or die "unable to open '$template': $!";
    # save file identifier onto our filestack
    push (@filehandle, $fileident);
    # save file handle into filehandle hash
    $filehandle{$fileident} = $fh;

    {
    my ($ident) = $filehandle[-1];
    my ($fh) = $filehandle{$ident};
    #my ($line) = $fh->getline;
    my ($line) = <$fh>;
    chomp $line;
    print STDOUT "1 \$line = '$line'\n";
    }

    {
    my ($ident) = $filehandle[-1];
    my ($fh) = $filehandle{$ident};
    #my ($line) = $fh->getline;
    my ($line) = <$fh>;
    chomp $line;
    print STDOUT "2 \$line = '$line'\n";
    }
  }

  # test outside of defining block
  {
  my ($ident) = $filehandle[-1];
  my ($fh) = $filehandle{$ident};
  #my ($line) = $fh->getline;
  my ($line) = <$fh>;
  chomp $line;
  print STDOUT "3 \$line = '$line'\n";
  }

}


--
## John Mendenhall
## jem@electriciti.com


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

Date: Thu, 25 Feb 1999 17:30:29 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: IO::File <$fh> vs $fh->getline
Message-Id: <1dnslhf.1m14chy1iz02w8N@bay3-164.quincy.ziplink.net>

John Mendenhall <jem@electriciti.com> wrote:

>     my ($line) = <$fh>;
         ^^^^^^^^^

List context.  <$fh> reads in the entire file, assigns the first line to
$line, and discards the remaining lines.

You wanted

  my $line = <$fh>;


-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 25 Feb 1999 18:01:47 -0500
From: Uri Guttman <uri@ibnets.com>
To: John Mendenhall <jem@electriciti.com>
Subject: Re: IO::File <$fh> vs $fh->getline
Message-Id: <39hfsahyuc.fsf@ibnets.com>

>>>>> "JM" == John Mendenhall <jem@electriciti.com> writes:

  JM>     #my ($line) = $fh->getline;
  JM>     my ($line) = <$fh>;

questions: in what context is <$fh> being executed, scalar or list? do
you know how the behavior of <> differs between the contexts? the answer 
to your problem is in those questions.

<rant>
this is one reason (of many) why i don't like to assign to my statements 
(except for @_). i never liked it in c either. declarations and
assignments should be separate statements.
</rant>

hth,

uri


-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: 25 Feb 1999 23:40:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: IO::File <$fh> vs $fh->getline
Message-Id: <7b4n0u$5gf$1@client2.news.psi.net>

John Mendenhall (jem@electriciti.com) wrote on MMIV September MCMXCIII in
<URL:news:36D5BC31.41C67EA6@electriciti.com>:
//     my ($line) = <$fh>;


You suffer from parenphilia. Too much parens. 

     my ($line) = <$fh>;

puts the expression in *list* context, meaning that you read in all
the lines of the file, and assign the first one to $line, trowing
away the rest.

Use

     my $line = <$fh>;

and it will all work fine.



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


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

Date: Thu, 25 Feb 1999 15:27:48 -0800
From: John Mendenhall <jem@electriciti.com>
To: Ronald J Kimball <rjk@linguist.dartmouth.edu>
Subject: Re: IO::File <$fh> vs $fh->getline
Message-Id: <36D5DC74.167EB0E7@electriciti.com>

Ronald J Kimball wrote:
> 
> John Mendenhall <jem@electriciti.com> wrote:
> 
> >     my ($line) = <$fh>;
>          ^^^^^^^^^
> 
> List context.  <$fh> reads in the entire file, assigns the first line > to $line, and discards the remaining lines.
> 
> You wanted
> 
>   my $line = <$fh>;

Doooooohhhhhhhh!

Thanks for pointing that out!  (And, actually, thanks goes to Uri
Guttman who was the first to e-reach me!)  And, of course, thanks
to all you who have an answer in transit.

Fixed the problem and worked.  (Man, what a newbie question!)

JohnM


-- 
## John Mendenhall
## jem@electriciti.com


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

Date: Fri, 26 Feb 1999 01:02:36 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: IO::File <$fh> vs $fh->getline
Message-Id: <MomB2.9047$Ge3.35379165@news.itd.umich.edu>

In article <36D5BC31.41C67EA6@electriciti.com>,
John Mendenhall  <jem@electriciti.com> wrote:
>I am working on a system that opens multiple files, saving the
>open file handles in a hash to be used later.  However, when
>retrieved later, it does not work using <$fh> in all attempts
>after the first.  The use of $fh->getline works every time.

>Please let me know if you need any additional information.
>Also, please be gentle if it something stupid (as it usually
>is after staring at this code for hours on end).

The problem is a subtle one.  First, <$fh> and $fh->getline don't do
precisely the same thing.  Here's the code for IO::Handle::getline:

sub getline {
    @_ == 1 or croak 'usage: $fh->getline';
    my $this = shift;
    return scalar <$this>;
}

This function forces scalar context on <$this>, making it return only one
line.  If you use <$fh> directly, though, the context of its use determines
whether it returns one line (scalar) or an array of all of the rest of the
lines in the file (array).  This is described in the perlop man page.

In your code, you say:

>    my ($line) = <$fh>;

The parentheses mean that <$fh> is in array context, so the operator slurps
in every line in the file.  The first line is assigned to $line, and the
rest are discarded.  If you say

my $line = <$fh>;

 ...you'll get the behavior you want.

The reason you get a "Use of uninitialized value" warning after subsequent
executions of "my ($line) = <$fh>" is that the end of file has been
reached; <$fh> returns an empty list, and $line isn't assigned anything.
Compare:

perl -wle 'my ($line) = (); print $line'

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Fri, 26 Feb 1999 10:29:44 +0100
From: "Burkhard Kiesel" <burkhard.kiesel@med.siemens.de>
Subject: Is there a module or perl script for "computer telephony" (CTI)
Message-Id: <7b5p55$1t$1@med-iss3.erlm.siemens.de>

Hi there,

i found a program called SimplyPhone 1.0, where you can directly call a
phone number from a PC program. The PC is connected to the Internet.

Is there a Perl Module or script available, which does the same thing, means
I try to put it into a Web-Page for Online Support.

Thanks in advance

Burkhard




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

Date: Mon, 22 Feb 1999 21:39:09 +0000
From: "Alan W. Jurgensen" <alan@fullcompass.com>
Subject: Is there a utility to convert ksh to perl?
Message-Id: <36D1CE7D.EAAB4F74@fullcompass.com>

hiya,

yep, another perl newbie.  Have a looping text processing shell script that
runs horribly slow.... might as well convert to perl, eh?

Is there a script/utility to convert shell to perl... if only to get a head
start at it?

p.s. where on web are perl script examples ; 
whats your favorite perl resource site?

let me know!

thankx!!!

al-man
-- 
          +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
                 Alan W. Jurgensen  -  Full Compass Systems        
              phone: (608) 831-7330 - email: alan@fullcompass.com
          +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+


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

Date: Mon, 22 Feb 1999 17:42:20 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: "Alan W. Jurgensen" <alan@fullcompass.com>
Subject: Re: Is there a utility to convert ksh to perl?
Message-Id: <36D1DD4C.57B329C8@giss.nasa.gov>

"Alan W. Jurgensen" wrote:
> 
> hiya,
> 
> Is there a script/utility to convert shell to perl... if only to get a head
> start at it?

no, but if it's a simple shell script, then the necessary level
of Perl knowledge to rewrite it is fairly low.  (feel free to use
lots of "system()"s and backticks).

OTOH, if it's a complex shell script, presumably written by you,
then you'll have no problem learning enough perl to duplicate it.

> p.s. where on web are perl script examples ;
> whats your favorite perl resource site?

http://language.perl.com/info/documentation.html

> 
> let me know!

My fave Perl books are _Programming Perl_,
_Effective Perl Programming_, and _Advanced Perl Programming_.

--  
 "... the whole documentation is not unreasonably
  transportable in a student's briefcase."

	-- John Lions describing UNIX 6th Edition
 
 "This has since been fixed in recent versions."

	-- Kernighan & Pike


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

Date: Tue, 23 Feb 1999 01:09:56 +0000
From: Dante Lorenso <dante@lorenso.com>
Subject: Keeping Variables local to object invocation not entire Class.
Message-Id: <36D1FFE3.C4894B85@lorenso.com>

I've got the following script:
######################################
#!/usr/local/bin/perl

$foo = new happy ("FOO");
$bar = new happy ("BAR");

$foo->show;
$bar->show;
exit;

# --------------------
package happy;
use strict;

my $VALUE;

sub new {
    my $class = shift;
    my $word = shift;
    my $self = {};
    bless $self, $class;

    $self->{VALUE} = $VALUE = $word;
    return $self;
}

sub show {
    my ($self) = shift;
    printf ("%s\n%s\n\n", $VALUE, $self->{VALUE});
}
# --------------------
######################################

However, it output the following code:

----------
BAR
FOO

BAR
BAR
----------

What I want to to be able to name a variable like $VALUE instead of
having it be called $self->{VALUE}.  How can I do that without the
variable being scoped to the object instead of the instance of the
object?  There must be some sort of way to bless a variable into an
object such that it can be called be name from any of the methods, but
such that it is scoped to the object only.  Perhaps something like,

    bless $VALUE, $self;   ?

But, that didn't work for me...any thoughts or am I forced to use
hideous
syntax like $self->{VALUE} ??  The reason I ask is that it get REAL
messy when you start doing stuff like:

    @{$self->{ENTITY_LIST}{$entity_num}{BODY}} = qw|a b c 1 2 3|;

Thanks, and please CC: dante@lorenso.com if you've got a good
answer.

Dante

--
+------------------------  -------------------------------------------+
| D. Dante Lorenso     /  /  MCI Systemhouse / Cadence Design Systems |
| dlorenso@cadence.com \  \  Unix Sys Admin (Postmaster)              |
| 408.944.6875         /  /  San Jose, California                     |
+-----------------------  --------------------------------------------+





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

Date: Tue, 23 Feb 1999 01:10:21 +0000
From: Dante Lorenso <dante@lorenso.com>
To: dante@lorenso.com
Subject: Keeping Variables local to object invocation not entire Class.
Message-Id: <36D1FFFD.FEB9B49F@lorenso.com>

I've got the following script:
######################################
#!/usr/local/bin/perl

$foo = new happy ("FOO");
$bar = new happy ("BAR");

$foo->show;
$bar->show;
exit;

# --------------------
package happy;
use strict;

my $VALUE;

sub new {
    my $class = shift;
    my $word = shift;
    my $self = {};
    bless $self, $class;

    $self->{VALUE} = $VALUE = $word;
    return $self;
}

sub show {
    my ($self) = shift;
    printf ("%s\n%s\n\n", $VALUE, $self->{VALUE});
}
# --------------------
######################################

However, it output the following code:

----------
BAR
FOO

BAR
BAR
----------

What I want to to be able to name a variable like $VALUE instead of
having it be called $self->{VALUE}.  How can I do that without the
variable being scoped to the object instead of the instance of the
object?  There must be some sort of way to bless a variable into an
object such that it can be called be name from any of the methods, but
such that it is scoped to the object only.  Perhaps something like,

    bless $VALUE, $self;   ?

But, that didn't work for me...any thoughts or am I forced to use
hideous
syntax like $self->{VALUE} ??  The reason I ask is that it get REAL
messy when you start doing stuff like:

    @{$self->{ENTITY_LIST}{$entity_num}{BODY}} = qw|a b c 1 2 3|;

Thanks, and please CC: dante@lorenso.com if you've got a good
answer.

Dante

--
+------------------------  -------------------------------------------+
| D. Dante Lorenso     /  /  MCI Systemhouse / Cadence Design Systems |
| dlorenso@cadence.com \  \  Unix Sys Admin (Postmaster)              |
| 408.944.6875         /  /  San Jose, California                     |
+-----------------------  --------------------------------------------+





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

Date: 22 Feb 1999 18:33:45 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Keeping Variables local to object invocation not entire Class.
Message-Id: <36d20579@csnews>

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

In comp.lang.perl.misc, dante@lorenso.com writes:
:What I want to to be able to name a variable like $VALUE instead of
:having it be called $self->{VALUE}.  How can I do that without the
:variable being scoped to the object instead of the instance of the
:object?  There must be some sort of way to bless a variable into an
:object such that it can be called be name from any of the methods, but
:such that it is scoped to the object only.  

Have you looked at the Alias module on CPAN?  I think you
would like it.  It can do this things for you.

--tom
-- 
    "Many folks want nothing more than to live and let learn." --Larry Wall


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

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

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