[19487] in Perl-Users-Digest
Perl-Users Digest, Issue: 1682 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 2 21:05:27 2001
Date: Sun, 2 Sep 2001 18:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <999479106-v10-i1682@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 2 Sep 2001 Volume: 10 Number: 1682
Today's topics:
ANNOUNCE: Attribute::Handlers 0.75 (Damian Conway)
AoH - sorry for the no subj (TuNNe|ing)
Re: AoH - sorry for the no subj <vze2r2j8@verizon.net>
Re: AoH - sorry for the no subj <s_scrimp@bellsouth.net>
Re: AoH - sorry for the no subj (Tad McClellan)
Re: AoH - sorry for the no subj <krahnj@acm.org>
Re: AoH - sorry for the no subj (Tad McClellan)
Re: Black Perl (Martien Verbruggen)
Re: Compiling Perl 5.6.1 (Martien Verbruggen)
Re: Editing a text file? (E.Chang)
Re: Editing a text file? (Tad McClellan)
Re: Memory managment in perl (Martien Verbruggen)
Newbie Questions <chaoticsun@rejector.com>
Re: Newbie Questions <chaoticsun@rejector.com>
Re: Newbie Questions <wyzelli@yahoo.com>
Re: Newbie Questions (Tad McClellan)
Re: Performance : Shell X Perl <andrew.savige@ir.com>
Perl for Psion - where? CPAN link broken <stumo@bigfoot.com>
Re: Perl handcoded? <dtweed@acm.org>
Re: Recommendations for a PERL editor (Tad McClellan)
Re: Structuring a program (if statements) (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Sep 2001 22:07:54 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Attribute::Handlers 0.75
Message-Id: <9muajq$skv$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release
==============================================================================
Release of version 0.75 of Attribute::Handlers
==============================================================================
NAME
Attribute::Handlers - Simpler definition of attribute handlers
DESCRIPTION
This module, when inherited by a package, allows that package's class to
define attribute handler subroutines for specific attributes. Variables
and subroutines subsequently defined in that package, or in packages
derived from that package may be given attributes with the same names as
the attribute handler subroutines, which will then be called at the end
of the compilation phase (i.e. in a `CHECK' block).
EXAMPLE
package UNIVERSAL;
use Attribute::Handlers;
my %name;
sub name { return $name{$_[2]}||*{$_[1]}{NAME} }
sub Name :ATTR { $name{$_[2]} = $_[4] }
sub Purpose :ATTR { print STDERR "Purpose of ", &name, " is $_[4]\n" }
sub Unit :ATTR { print STDERR &name, " measured in $_[4]\n" }
package main;
my $capacity : Name(capacity)
: Purpose(to store max storage capacity for files)
: Unit(Gb);
package Other;
sub foo : Purpose(to foo all data before barring it) { }
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 2001, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
==============================================================================
CHANGES IN VERSION 0.75
- Cleaned up AUTOLOAD
- Numerous bug fixes (thanks Pete)
- Fixed handling of attribute data that includes a newline (thanks Pete)
- Added "autotieref" option (thanks Pete)
- Switched off $DB::single
- Changed licence for inclusion in core distribution
- Fixed 'autotie' for tied classes with multi-level names (thanks Jeff)
==============================================================================
AVAILABILITY
Attribute::Handlers has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Attribute-Handlers.tar.gz
==============================================================================
------------------------------
Date: Sun, 02 Sep 2001 23:41:29 GMT
From: troll@gimptroll.com (TuNNe|ing)
Subject: AoH - sorry for the no subj
Message-Id: <3b92c38b.11657841@news.coserv.net>
I have a _|_ delimeted file. For the first example I already know the
keys, and all is well. For the second example I put the keys into the
DB file. However, when I run it, the very last line of the DB shows up
in all of the elements of the @data array. I realize ..or I think I
do, that this is because the %hash maintains the same namespace,
therefore everytime I write to the hash, I overwrite the previous
data. But then again, I don't really understand why this is different
from the first example. Is it an anonymous hash thing? Please give me
a link to a document or a book.
Peace,
TuNNe|ing
current perl playground -> http://www.gimptroll.com
EXAMPLE 1
_DB file contents_
video|humor|movie.mpg
audio|song|song.mp3
_end DB file contents_
_begin script_
open(DB,$dbfile) || die($!);
while(<DB>) {
chomp;
($type,$category,$filename) = split(/\|/);
$data = ({type => $type,category => $category, filename =>
$filename});
push(@fields,$data);
}
close(DB);
_end script_
EXAMPLE 2
_DB file contents_
type|video|category|humor|filename|movie.mpg
type|audio|category|song|filename|song.mp3
_end DB file contents_
open(DB,$dbfile) || die($!);
while (<FILE>) {
chomp;
%hash = split(/\|/,$_);
push(@data,\%hash);
}
close(DB);
------------------------------
Date: Sun, 02 Sep 2001 23:02:12 GMT
From: "Kurt Stephens" <vze2r2j8@verizon.net>
Subject: Re: AoH - sorry for the no subj
Message-Id: <UTyk7.5274$Op6.901643@typhoon1.gnilink.net>
"TuNNe|ing" <troll@gimptroll.com> wrote in message
news:3b92c38b.11657841@news.coserv.net...
> I have a _|_ delimeted file. For the first example I already know the
> keys, and all is well. For the second example I put the keys into the
> DB file. However, when I run it, the very last line of the DB shows up
> in all of the elements of the @data array. I realize ..or I think I
> do, that this is because the %hash maintains the same namespace,
> therefore everytime I write to the hash, I overwrite the previous
> data. But then again, I don't really understand why this is different
> from the first example. Is it an anonymous hash thing? Please give me
> a link to a document or a book.
> Peace,
> TuNNe|ing
> current perl playground -> http://www.gimptroll.com
>
> EXAMPLE 1
> _DB file contents_
> video|humor|movie.mpg
> audio|song|song.mp3
> _end DB file contents_
> _begin script_
> open(DB,$dbfile) || die($!);
> while(<DB>) {
> chomp;
> ($type,$category,$filename) = split(/\|/);
> $data = ({type => $type,category => $category, filename =>
> $filename});
You can ditch the parens, but here you assign an anonymous hash reference to
$data. The line below pushes the reference into @fields, and all is well.
> push(@fields,$data);
> }
> close(DB);
> _end script_
>
> EXAMPLE 2
> _DB file contents_
> type|video|category|humor|filename|movie.mpg
> type|audio|category|song|filename|song.mp3
> _end DB file contents_
> open(DB,$dbfile) || die($!);
> while (<FILE>) {
> chomp;
> %hash = split(/\|/,$_);
Here you are filling %hash with the data. When you push the reference to
%hash into @data, you are always pushing a reference to the same hash.
> push(@data,\%hash);
> }
> close(DB);
Why dont you try something like the code below, which splits the data into a
new, anonymous hash and pushes the reference onto @data.
while (<FILE>) {
chomp;
push(@data, {split(/\|/,$_)});
}
HTH,
Kurt Stephens
------------------------------
Date: Sun, 2 Sep 2001 19:37:59 -0500
From: "Steve Scrimpshire" <s_scrimp@bellsouth.net>
Subject: Re: AoH - sorry for the no subj
Message-Id: <qiAk7.319$ZJ.17189@e3500-atl2.usenetserver.com>
"TuNNe|ing" <troll@gimptroll.com> wrote in message
news:3b92c38b.11657841@news.coserv.net...
<snip>
> EXAMPLE 2:
> _DB file contents_
> type|video|category|humor|filename|movie.mpg
> type|audio|category|song|filename|song.mp3
> _end DB file contents_
> open(DB,$dbfile) || die($!);
> while (<FILE>) {
> chomp;
> %hash = split(/\|/,$_);
> push(@data,\%hash);
> }
> close(DB);
I'm a relative newbie to Perl, so if I were you, I would listen to what the
others have to say, also, but here's my 2 cents worth. The loop in the
second example never executes properly, because the while statement contains
the wrong filehandle:
> open(DB,$dbfile) || die($!);
> while (<FILE>) {
> chomp;
> %hash = split(/\|/,$_);
> push(@data,\%hash);
> }
> close(DB);
Shouldn't that read?
> open(DB,$dbfile) || die($!);
> while (<DB>) {
> chomp;
> %hash = split(/\|/,$_);
> push(@data,\%hash);
> }
> close(DB);
Notice the change in the second line. Also, I would use local variables as
suggested by the others.
--
Steve Scrimpshire (s_scrimp@bellsouth.net)
PGP Key ID: 0xFA6E3F81
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 8/23/01
------------------------------
Date: Sun, 2 Sep 2001 20:00:21 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: AoH - sorry for the no subj
Message-Id: <slrn9p5i0l.k9q.tadmc@tadmc26.august.net>
TuNNe|ing <troll@gimptroll.com> wrote:
>_DB file contents_
>video|humor|movie.mpg
>audio|song|song.mp3
>_end DB file contents_
>_begin script_
>open(DB,$dbfile) || die($!);
>while(<DB>) {
> chomp;
> ($type,$category,$filename) = split(/\|/);
> $data = ({type => $type,category => $category, filename =>
>$filename});
> push(@fields,$data);
>}
>close(DB);
>_end script_
For future reference, you can put the "file data" right in
your Perl source. This makes it easier for others to run
your code and is less ambiguous too:
while(<DATA>) { # note the different filehandle here
chomp;
($type,$category,$filename) = split(/\|/);
$data = ({type => $type,category => $category, filename => $filename});
push(@fields,$data);
}
__DATA__
video|humor|movie.mpg
audio|song|song.mp3
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 02 Sep 2001 23:32:55 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: AoH - sorry for the no subj
Message-Id: <3B92C219.756B0F8@acm.org>
TuNNe|ing wrote:
>
> I have a _|_ delimeted file. For the first example I already know the
> keys, and all is well. For the second example I put the keys into the
> DB file. However, when I run it, the very last line of the DB shows up
> in all of the elements of the @data array. I realize ..or I think I
> do, that this is because the %hash maintains the same namespace,
> therefore everytime I write to the hash, I overwrite the previous
> data. But then again, I don't really understand why this is different
> from the first example. Is it an anonymous hash thing? Please give me
> a link to a document or a book.
You are using global variables instead of lexical variables.
> EXAMPLE 1
> _DB file contents_
> video|humor|movie.mpg
> audio|song|song.mp3
> _end DB file contents_
> _begin script_
> open(DB,$dbfile) || die($!);
> while(<DB>) {
> chomp;
> ($type,$category,$filename) = split(/\|/);
> $data = ({type => $type,category => $category, filename =>
> $filename});
> push(@fields,$data);
chomp;
my %hash;
@hash{ ( 'type', 'category', 'filename' ) } = split /\|/;
push @fields, \%hash;
> }
> close(DB);
> _end script_
>
> EXAMPLE 2
> _DB file contents_
> type|video|category|humor|filename|movie.mpg
> type|audio|category|song|filename|song.mp3
> _end DB file contents_
> open(DB,$dbfile) || die($!);
> while (<FILE>) {
> chomp;
> %hash = split(/\|/,$_);
> push(@data,\%hash);
chomp;
my %hash = split /\|/;
push @data, \%hash;
> }
> close(DB);
my() creates a new variable each time through the loop.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 2 Sep 2001 19:57:31 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: AoH - sorry for the no subj
Message-Id: <slrn9p5hrb.k9q.tadmc@tadmc26.august.net>
John W. Krahn <krahnj@acm.org> wrote:
>TuNNe|ing wrote:
>>
>> I have a _|_ delimeted file. For the first example I already know the
>> keys, and all is well. For the second example I put the keys into the
>> DB file. However, when I run it, the very last line of the DB shows up
>> in all of the elements of the @data array. I realize ..or I think I
>> do, that this is because the %hash maintains the same namespace,
>> therefore everytime I write to the hash, I overwrite the previous
>> data. But then again, I don't really understand why this is different
>> from the first example. Is it an anonymous hash thing? Please give me
>> a link to a document or a book.
>
>You are using global variables instead of lexical variables.
And if you are using references without having "use strict;"
near the top of your program, then you deserve any pain
you get.
Ask for all the help you can get, enable strictures.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 02 Sep 2001 23:21:27 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Black Perl
Message-Id: <slrn9p5fnn.4ug.mgjv@verbruggen.comdyn.com.au>
[Post reorganised to obey the normal arrow of time]
On 2 Sep 2001 10:06:54 -0700,
N01937 <N01937@hushmail.com> wrote:
> mgjv@tradingpost.com.au (Martien Verbruggen) wrote in message news:<slrn9p42ce.3ga.mgjv@martien.heliotrope.home>...
>> On 2 Sep 2001 02:52:34 -0700,
>> N01937 <N01937@hushmail.com> wrote:
>> > Does anyone know the author of the Black Perl poem found in the Camel Book?
>>
>> Hmm.. I thought it was by Larry Wall, himself, but it's actually by
>> Sharon Hopkins, who's done quite a few poems in Perl.
>>
> In my copy (3rd edition), it attributes the first poem to Sharon, but
> not Black Perl. Larry writes, "A person who wishes to remain anonymous
> wrote the following example of Black Perl". I was wondering if anyone
> has taken credit since.
I should have probably quoted the source for my remark.
Camels and Needles: Computer Poetry meets the Perl Programming Language
by Sharon Hopkins,
http://kiev.wall.org/~sharon/plpaper.ps
(I haven't been able to get kiev.wall.org to respond, but it probably
is stil there)
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
Interactive Media Division | down all the noises the baby makes
Commercial Dynamics Pty. Ltd. | so later I can ask him what he meant
NSW, Australia | - Steven Wright
------------------------------
Date: Sun, 02 Sep 2001 23:55:19 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Compiling Perl 5.6.1
Message-Id: <slrn9p5hn7.4ug.mgjv@verbruggen.comdyn.com.au>
On 31 Aug 2001 09:50:13 -0700,
Alan Rice <arice@benchmark-systems.com> wrote:
> Hey All
> I'm tring to Compile Perl 5.6.1 on an aix 4.2.1.0 box.
> Using gcc version 2.95.2 19991024 (release) gotton for UCLA's site.
> It's the make giving me poblems.
make is fine. It's gcc that is the problem.
> make
[snip]
> `sh cflags libperl.a toke.o` toke.c
> CCCMD = gcc -DPERL_CORE -c -fno-strict-aliasing -I/usr/local/include
> -O
> gcc: Internal compiler error: program cc1 got fatal signal 9
> make: 1254-004 The error code from the last command is 1.
Sounds like a bug in gcc to me, or otherwise a problematic
installation of gcc.
Isn't the 2.95.2 release a beta? Have you tried it with a different
version? Have you compiled other (large) programs with this gcc?
> Can anyone tell me What a fatal signal 9 is and how to fix it?
Compile a stable release of gcc, and follow the instructions (build
three times). Try compiling Perl again.
Martien
--
Martien Verbruggen |
Interactive Media Division | This matter is best disposed of from
Commercial Dynamics Pty. Ltd. | a great height, over water.
NSW, Australia |
------------------------------
Date: Sun, 02 Sep 2001 23:35:07 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Editing a text file?
Message-Id: <Xns9110C8037F715echangnetstormnet@207.106.92.86>
"Schryke" <schrykex2@yahoo.com> wrote in
<DAvk7.20458$xb.13572804@news1.mntp1.il.home.com>:
>Thanks for the info. It's helped a bit. I've figured out how to
>open, close, and write the file, my main problem right now is doing
>the actual editing. I need something like a CGI text editor/notepad
>sort of thing. I can open the file, I can display it, I can save it,
>I just can't edit it without downloading it, opening it in notepad
>and uploading it again when I'm done.
>
Please don't "Top-post". Write your replies after the text to which
you are replying. Not everyone who reads your article has necessarily
read the previous post, and even then probably won't remember what it
was about. Also, don't copy signatures into your reply.
>"fruiture" <info@fruiture.de> wrote in message
>news:9mu04e$aig$01$1@news.t-online.com...
>> "Schryke" <schrykex2@yahoo.com> wrote:
>>> I'm totally lost. I'm new at programming perl and CGI, and I need
>>> to be able to open a specific text file and edit a list of names
>>> on it then save it again... can anyone help me out here?
>>
[code recommendations snipped]
You could output a form with the file content included as the value of
a textarea field. Edit the text and submit the form to a script which
will update the file. Look at the documentation for CGI.pm
(http://stein.cshl.org/WWW/software/CGI/) for how to process form data.
Keep in mind that security can be an issue if your script is publically
accessible.
--
EBC
------------------------------
Date: Sun, 2 Sep 2001 19:41:36 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Editing a text file?
Message-Id: <slrn9p5gtg.k65.tadmc@tadmc26.august.net>
Schryke <schrykex2@yahoo.com> wrote:
>Thanks for the info. It's helped a bit. I've figured out how to open, close,
>and write the file, my main problem right now is doing the actual editing.
perldoc -q change
"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?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 02 Sep 2001 23:49:05 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Memory managment in perl
Message-Id: <slrn9p5hbg.4ug.mgjv@verbruggen.comdyn.com.au>
On 2 Sep 2001 07:47:41 -0700,
Nkhouri <circuller@yahoo.com> wrote:
> mgjv@tradingpost.com.au (Martien Verbruggen) wrote in message news:<slrn9p3jdv.3ga.mgjv@martien.heliotrope.home>...
>>
>> On 1 Sep 2001 22:44:13 -0700,
>> Nkhouri <circuller@yahoo.com> wrote:
>>
>> > - where i can find a good resource about memory management in perl ?
>>
>> Memory management in Perl is never necessary [1]. It does it all for
>> you. What specifically do you want to know?
>
> I use many sql statments in my perl program and a big hash table ,
And where does this hash table come from? What does it contain?
> i need to know how much mem the hash is using and the mem address it
> starts and ends at {i know its not always mem squenced} ! as for the
mem squenced?
Perl has no memory addresses, and you won't be able to get that
information from inside of regular Perl. If you read up on the
internals of Perl (perlguts) you may be able to make a reasonable
estimate. Maybe one of the Debug modules can give you an idea as well.
> sql statments , i cant tell if the statments auto free its resources
> after its executed and read ?
I am not sure what you mean. The statements don't free anything,
because they don't hold anything. If you are using the DBI module, and
you are using statement handles that have been returned from
DBI::prepare() or so, then they will most likely release any resources
they need once the last reference to them disappears. If you use
lexical variables to hold that reference, that's most likely at the
end of the block the variable was declared in.
> i dont want to call sql->finish explicitly and its being already auto
> finished !
But that has very little to do with Perl's memory management. It has
everything to do with what the DBI and the DBD::* driver you use do on
a finish(). And there is likely to be a lot more done than just a bit
of memory management. Many database drivers require you to call
finish() just so they can clean up the connection, and/or signal the
libraries that you're done with this bit.
I can tell you one thing: The hash that _you_ have in your program
will not be automatically cleaned up by calling finish(). I am
guessing that you either have copies of what came back from the
fetch_row()s or you have references to that. Until you empty the hash,
or it goes out of scope, that memory will stay around.
Why don't you present a (as small as possible, syntactically correct)
example program, and ask more specific questions, so it may be a bit
more clear to us what exactly you are worried about? Maybe you could
put some comments in it to make clear what you mean by 'sql statement'
and 'after its executed and read'.
To summarise:
Perl has no memory addresses. You cannot, and don't need to, look at
what goes on with Perl's memory management internally.
DBI is not Perl. It has its own requirements and DBI::finish does much
more than just a bit of memory management.
If you are worried about memory usage, you shouldn't be using Perl.
Perl can use up to an order of magnitude more memory, depending on the
structures you use, than an equivalent program in C.
The simplest way to think about Perl memory management, is to
remember that each bit of memory in Perl has a reference count. That
reference count gets increased when a reference to that memory is put
in place, and decreased when it disappears. When it becomes 0, the
memory is freed. You hardly ever need worry about this.
To be frugal with memory, you make sure that all your variables
(scalars, hashes, arrays), have as tight a scope as possible: Declare
them where they need to be used, and no sooner, and limit them to the
block in which they are used. As soon as the block ends, the whole
kaboodle will be cleaned up. use the strict pragma, and lexically
scope your variables [1].
my @array;
{
my %hash;
my $foo (my $line = <LARGE_FILE>)
{
# Fill @array, using %hash
}
# $line is inaccessible here, and all memory associated with it is
# freed.
}
# %hash is inaccessible here, and all memory associated with it (that
# has no other references) is freed. You can now use @array.
# To free all memory associated with the elements of @array (again,
# that have no other references):
@array = ();
Read perldata, perlref, and maybe, if you're interested, perlguts, the
section 'Reference Counts and Mortality'.
Martien
[1] Of course, these are just things that make your life easier. You
can explicitly empty arrays, and undefine scalars, even when they're
package variables. It's just easier to let lexical scope deal with
most of that.
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Mon, 03 Sep 2001 00:18:46 GMT
From: ChaoticSun <chaoticsun@rejector.com>
Subject: Newbie Questions
Message-Id: <0ni5ptsr06rrehr3b2juha9ko27poar9jb@4ax.com>
I am just beginning to learn Perl and picked up the 3rd edition of the
Llama book ("Learning Perl") by Schwartz and Phoenix. So far I have
run into two problems. I would appreciate any advice regarding the
two applications printed below:
#!perl
use strict
my @names = qw(fred betty barney dino wilma pebbles bamm-bamm);
my $result = &which_element_is ("dino", @names);
print $result;
sub which_element_is {
my($what, @list) = @_;
print "In subroutine.\n";
foreach (0..$#list) {
print "Currently looking at $list[$_] which is $_.\n";
if ($what eq $list[$_]) {
return $_;
}
}
-1;
}
AND
#!perl
use strict
sub total {
my $sum;
foreach (@_) {
$sum += $_;
}
$sum;
}
my @fred = qw (1 3 5 7 9);
my $fred_total = &total(@fred);
print "The total of \@fred is $fred_total.\n";
print "Enter some numbers on separate lines:\n";
my $user_total = &total(<STDIN>);
print "The total of those numbers is $user_total.\n";
Both programs work as expected if I comment out the "use strict" line.
When it is left in, the first program never executes the foreach block
and the second program gives me the following error message:
syntax error at ex4-1.pl line 4, near "use strict
sub total "
Execution of ex4-1.pl aborted due to compilation errors.
What am I doing wrong?!!!!!!
------------------------------
Date: Mon, 03 Sep 2001 00:26:41 GMT
From: ChaoticSun <chaoticsun@rejector.com>
Subject: Re: Newbie Questions
Message-Id: <hgj5pt444qd4g3i4polkrng66q928qrkns@4ax.com>
And then I took another look at the code...
use strict;
I forgot to end it with a semicolon...
------------------------------
Date: Mon, 3 Sep 2001 10:05:17 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Newbie Questions
Message-Id: <u9Ak7.20$295.417@wa.nnrp.telstra.net>
"ChaoticSun" <chaoticsun@rejector.com> wrote in message
news:0ni5ptsr06rrehr3b2juha9ko27poar9jb@4ax.com...
> I am just beginning to learn Perl and picked up the 3rd edition of the
> Llama book ("Learning Perl") by Schwartz and Phoenix. So far I have
> run into two problems. I would appreciate any advice regarding the
> two applications printed below:
>
> #!perl
> use strict
should be:
use strict;
You forgot the semi-colon.
This is probably one of the most common causes for syntax errors. Double
check your typing carefully.
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Sun, 2 Sep 2001 20:03:02 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Newbie Questions
Message-Id: <slrn9p5i5m.k9q.tadmc@tadmc26.august.net>
Wyzelli <wyzelli@yahoo.com> wrote:
>"ChaoticSun" <chaoticsun@rejector.com> wrote in message
>news:0ni5ptsr06rrehr3b2juha9ko27poar9jb@4ax.com...
>> I am just beginning to learn Perl and picked up the 3rd edition of the
>> Llama book ("Learning Perl") by Schwartz and Phoenix. So far I have
>> run into two problems. I would appreciate any advice regarding the
>> two applications printed below:
>>
>> #!perl
>> use strict
>
>should be:
>
>use strict;
>
>You forgot the semi-colon.
Actually, that should be:
#!perl -w
use strict;
Ask perl for all the help you can get, enable warnings.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 3 Sep 2001 10:03:29 +1000
From: "Knob" <andrew.savige@ir.com>
Subject: Re: Performance : Shell X Perl
Message-Id: <lNzk7.2$nh.13573@news0.optus.net.au>
"Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid> wrote in
message news:3b91c5d1$2$fuzhry$mr2ice@news.patriot.net...
> In <3I0j7.10$De6.3375@news0.optus.net.au>, on 08/29/2001
> at 05:19 PM, "Knob" <andrew.savige@ir.com> said:
>
> >My current approach is to bundle Perl v5.6.1,say, (along with extra
> >modules) with our product and have the installation sh script unpack
> >this distribution.
>
> I'd consider that unacceptable unless the script is smart enough to
> check what is already installed and to get confirmation before
> installing a new version
>
> --
Let me clarify how it works.
When you install product Acme, say, you choose the installation
directory, /home/acme, for example. Perl 5.6.1, along with
extra modules, is unpacked in /home/acme/perl, and the
Acme user's environment adjusted so that he/she uses
that version, not /usr/bin/perl, when using product Acme
(perhaps rename the binary 'acmeperl' rather than 'perl').
The Acme product is now more self-contained, simplifying
QA, reducing support calls, and allowing you to install and
play with the thing without needing root permissions.
Moreover, it simplifies portability (Acme programmers just
write to Perl v5.6.1) and makes Perl programming more
enjoyable if you like using the latest Perl features.
The downside is that you now have multiple versions of
Perl installed on your machine.
Andrew.
------------------------------
Date: Mon, 3 Sep 2001 01:06:08 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Perl for Psion - where? CPAN link broken
Message-Id: <HNzk7.37547$Nb2.6841854@news2-win.server.ntlworld.com>
Hi, looking for the port of Perl to the Psion. The link in CPAN (on the page
http://www.perl.com/CPAN-local/ports/) is
http://www.science-computing.de/o.flebbe/perl/ but this seems to be broken.
Anyone got another one?
------------------------------
Date: Mon, 03 Sep 2001 00:52:46 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: Perl handcoded?
Message-Id: <3B92D347.9DD39A95@acm.org>
Lijiv Khil wrote:
> I was going through the sources of perl v 1.0. Is Perl written without
> using any compiler construction tools like Lex and Yacc? I found that
> all the transition tables etc were hand-coded in the sources.
Even perl-1.000 (found at http://www.etla.org/retroperl/perl1/) has a
perl.y file, so the answer is no. You might be looking at a distribution
for a platform that didn't (yet) have a yacc or bison (DOS?), and so it
included the pre-processed grammar.
-- Dave Tweed
------------------------------
Date: Sun, 2 Sep 2001 17:20:23 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Recommendations for a PERL editor
Message-Id: <slrn9p58kn.k3h.tadmc@tadmc26.august.net>
RoJo <rojo@mindspring.com> wrote:
>
>I'm new to PERL.
We can tell because you did not spell it properly.
"Perl" is used to refer to the language proper.
"perl" is used to refer to the implementation of the language
(the interpreter).
"PERL" is not used (other than to indicate that you don't know Perl).
>I keep getting "The page cannot be displayed" when I
>use Windows 2000's Notepad to edit my scripts.
I have never seen such a message, it does not come from perl.
A first step would be to figure out where the message is coming from.
>An ISP support person
Why is an ISP involved? You don't need an ISP to write or run
Perl programs.
>tells me it has syntax errors that are introduced by the editor.
What errors does it introduce?
>Can someone recommend to me a reliable Windows-based editor that WON'T
>create these problems for me ???
http://www.vim.org/
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 2 Sep 2001 19:43:51 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Structuring a program (if statements)
Message-Id: <slrn9p5h1n.k65.tadmc@tadmc26.august.net>
Peter Mann <Pcmann1@btinternet.com> wrote:
>In C, there is a case statement, but i can't find similar method in my Perl
>book!
perldoc -q case
"How do I create a switch or case statement?"
You are expected to check the Perl FAQs *before* posting to
the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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.
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 1682
***************************************