[10595] in Perl-Users-Digest
Perl-Users Digest, Issue: 4187 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 10 08:07:34 1998
Date: Tue, 10 Nov 98 05:00:40 -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 Tue, 10 Nov 1998 Volume: 8 Number: 4187
Today's topics:
Re: 2nd posting: why do I get in this case: "untie atte ronald_f@my-dejanews.com
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Another reg. expr. question. (Slash on end of path) <kjetil@balder.no>
Re: Another reg. expr. question. (Slash on end of path) <rootbeer@teleport.com>
Re: Attaching a binary file... (I.J. Garlick)
attaching a jpeg <gary.ennis@strath.ac.uk>
Re: DOS to UNIX (Tad McClellan)
Re: DOS to UNIX ruxfounder@my-dejanews.com
Enjoy the power of newsgroups (Was: newbie question) (Tore Aursand)
Re: EOF condition before actual EOF (Bart Lateur)
Re: File upload/Netscape4.0.7> <perlguy@technologist.com>
Help! : a perl script to tranlating a file structure ( <Athula.Herath@ogs.co.uk>
Re: Help, I'm stuck again (this one may push the envelo <rootbeer@teleport.com>
Re: Help, I'm stuck again (this one may push the envelo (Bart Lateur)
Re: How to run perl scripts written in C++ on windows? <imcn@mpx.com.au>
Re: Index of an element in a list? (M.J.T. Guy)
Is there a compiler for Perl? (Peter)
Re: Learning Perl by video <perlguy@technologist.com>
Re: Looking for a web site with good script examples <perlguy@technologist.com>
mv -f in Perl pcbel@my-dejanews.com
Re: mv -f in Perl jbharvey@corp.home.net
Re: OLE Sub routine scalar assignment problem <msergeant@ndirect.co.uk_NOSPAM>
Re: Perl/Win'95 <harrisp2@cf.ac.uk>
Re: Perl/Win'95 <perlguy@technologist.com>
pwd without backticks? <NOSPAM.stephane.barizien@ocegr.fr>
Re: pwd without backticks? <dean_darlison@dial.pipex.com>
Re: pwd without backticks? <dean_darlison@dial.pipex.com>
Re: select case? <hendrik.woerdehoff@sdm.de>
Re: Sorry Array-Hash-Problem nomam@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 10 Nov 1998 09:43:17 GMT
From: ronald_f@my-dejanews.com
To: montyt@bestnet.com
Subject: Re: 2nd posting: why do I get in this case: "untie attempted..."
Message-Id: <7291rl$1q5$1@nnrp1.dejanews.com>
In article <72734m$30624@roc344.ghc.org>,
"Monty Taylor" <montyt@bestnet.com> wrote:
> Hello,
> I tried running your script fragment, and I didn't run into the same
> problem. My perl didn't like the _hash as a bareword with strict turned on.
Now *that* is strange! _hash should not be considered as bareword here!
> It obviously didn't like hash, either, so I stuck an r in there and made it
> harsh and it runs fine.
Looks like you've got a very harsh perl implementation ;-)
> Since that script looks like a partial re-write of something larger, maybe
> there is something different between your big script and what you posted?
It is, but the point is that the error even occurs in the small script that I
posted. I can't understand why it runs on your system. What version of perl
are you using, and on which platform does it run? perl -v says on my machine:
This is perl, version 5.004_04 built for PA-RISC1.1
Could it be that you made an error when cutting and pasting my example? Here
it is again (the only difference being that I made additional comment
annotations in my original posting):
#!/usr/local/bin/perl -w
package Demo;
use strict;
use Fcntl;
use NDBM_File;
sub _h { return shift->{_hash}; }
# simulate "new"
my $self = { _hash => {} };
bless $self,"Demo";
(tie(%{$self->_h}, "NDBM_File", "dh.db", O_RDWR|O_CREAT, 0640)) or die;
if(tied %{$self->_h})
{
untie %{$self->_h};
}
==== File ends here ====
I called this file "pt2" and made it chmod u+x. When I run it, I get the
message
untie attempted while 1 inner references still exist at ./pt2 line 18.
As another reader suggested, this might be due to a bug in perl, so I will
submit a bug report.
[this message posted and mailed]
--
Ronald Fischer <ronald_f@my-dejanews.com>
http://ourworld.compuserve.com/homepages/ronald_fischer/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 10 Nov 1998 11:24:01 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage910697041.27737@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 10:11:22 +0100
From: Kjetil Svendsberget <kjetil@balder.no>
Subject: Another reg. expr. question. (Slash on end of path)
Message-Id: <3648033A.A25D1F63@balder.no>
This time i want this:
s: => s:\
s:\ => s:\
etc...
That is 'any-variant-of-a-path', check if it has a slash OR backslash at
the end of the path. If NOT add slash OR backslash.
What ive come up with so far:
#Check OS
if ($Config{'osname'} !~ /win/i ) { $os = 0 }
else { $os = 1 };
#Set slash or backslash
if ($os){ $slash = '\\' }
else { $slash = '/' };
print "Enter destination directory to install to:";
chomp($dest_dir = <STDIN>);
if ($dest_dir !~ /\$slash$/) {
$dest_dir .= "$slash";
}
The last one does work. It always add a backslash (windows) no matter
what. But if i do:
if ($dest_dir !~ /\\$/) {
$dest_dir .= "$slash";
}
instead. It works like a charm. How do i protect the '$slash' properly?
And no i cannot set $slash to $slash = '\', becuase then the compiler
croaks. (as everybody knows no doubt)
Any help appricated!
------------------------------
Date: Tue, 10 Nov 1998 09:35:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Another reg. expr. question. (Slash on end of path)
Message-Id: <Pine.GSO.4.02A.9811100119160.2742-100000@user2.teleport.com>
On Tue, 10 Nov 1998, Kjetil Svendsberget wrote:
> That is 'any-variant-of-a-path', check if it has a slash OR backslash
> at the end of the path. If NOT add slash OR backslash.
It sounds as if you're saying this:
if string ends in slash, leave it alone.
if string ends in backslash, leave it alone.
otherwise, add a slash or a backslash
How do you decide whether to add a slash or a backslash, then? But maybe
you want this:
s#(^.*[^/\\]$|^$)#$1/#s; # Add slash at end if missing
> #Check OS
> if ($Config{'osname'} !~ /win/i ) { $os = 0 }
> else { $os = 1 };
>
> #Set slash or backslash
> if ($os){ $slash = '\\' }
> else { $slash = '/' };
Did you realize that you can use a forward slash even on DOS/Windows?
> if ($dest_dir !~ /\$slash$/) {
> $dest_dir .= "$slash";
> }
I don't think that's doing what you want. That is, it's not interpolating
$slash into the pattern. Also, those double-quotes are merely misleading.
> The last one does work. It always add a backslash (windows) no matter
> what.
Unless the $dest_dir is '$slash', for example... Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 08:58:38 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Attaching a binary file...
Message-Id: <F277Lq.Dyu@csc.liv.ac.uk>
In article <3647335b.0@news.takas.lt>,
vip@takas.lt (VYTiS) writes:
> Hi, does anyone know how to attach a binary file (let's say, a .zip) when
> sending email from perl (through sendmail)???
>
> Thanks.
Yes you need the MIME-Tools from CPAN.
In particular you need to encode the binary file using base64 MIME encoding.
The MIME-Tools modules give you everything you need to accomplish this.
--
--
Ian J. Garlick
<ijg@csc.liv.ac.uk>
We are all agreed that your theory is crazy. The question which
divides us is whether it is crazy enough to have a chance of being
correct. My own feeling is that it is not crazy enough.
-- Niels Bohr
------------------------------
Date: Tue, 10 Nov 1998 11:41:12 +0000
From: Gareth Ennis <gary.ennis@strath.ac.uk>
Subject: attaching a jpeg
Message-Id: <36482658.794B@strath.ac.uk>
is it possible to attach a file (say a jpeg) in an email which is sent
via a perl script.
I've seen mail modules that claim to do it, but i'd rather just add the
necessary code myself and do it straight from scrath....
At present i have this....
## Sends email to recipient
open (MAIL, "| mail $recip_email") ;
print MAIL "To: $recip_email\n";
print MAIL "From: $sender_email\n";
print MAIL "Subject: Subject title.\n" ;
print MAIL "$message\n\n" ;
close (MAIL);
which works fine... but now want to be able to send a graphic to the
recipient as well...
Any ideas much appreciated.
--
Gareth Ennis
ABACUS - Strathclyde University
email: gary.ennis@strath.ac.uk
http://iris.abacus.strath.ac.uk/new/
------------------------------
Date: Tue, 10 Nov 1998 06:57:04 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: DOS to UNIX
Message-Id: <07d927.3ob.ln@flash.net>
Ethan H. Poole (ehpoole@ingress.com) wrote:
: [Posted and Emailed] In article <7281r3$9or$1@trex.antw.online.be>,
: Roderik.Valcke@unicall.be says...
[ snip "how to remove carriage returns" question ]
: $string =~ s/\r|\r\n|\n/\n/g;
: That will probably have the desired affect.
Through a convoluted path, that will likely have the desired effect.
But there are two strange things with doing it that way:
1) The last alternation substitutes a newline for a newline.
That's a no-op that uses CPU cycles...
2) If $string has a \r\n sequence the second alternation will
*never* match. Rather the \r will match the first alternation.
The pattern is matched "left to right", so you should
arrange to have the _longest_ pattern with a common
prefix first.
------------------
#!/usr/bin/perl -w
$_ = 'ab';
print "$1\n" if /(a|ab)/;
------------------
prints 'a'
: Read up on Regular Expressions (regex) and substitution and familiarize
: yourself with what the function "$string =~ s/......" is performing in the
: above. This is one of Perl's greatest features.
Ditto ;-)
But for replacing single characters a regex is *not* the best
approach.
tr/\r//d; # remove CRs, but do it _much_ faster than s///g
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 10 Nov 1998 12:25:51 GMT
From: ruxfounder@my-dejanews.com
Subject: Re: DOS to UNIX
Message-Id: <729bcg$94i$1@nnrp1.dejanews.com>
In article <7281r3$9or$1@trex.antw.online.be>,
"Roderik Valcke" <Roderik.Valcke@unicall.be> wrote:
> Hi
>
> I'm looking for a perl code to change in a $string the hexcode "0D 0A" to
> only "0A";
> before exporting by the string to a file
>
> open (FILE,">$filename");
> print FILE "$string";
> close (FILE); .
>
> I've tried $string =~ s/\x0d\x0a/\x0a/g; but it always changes the "0A"
> to "0D 0A" once it's writen to the file;
Ok, what about s/\r\n/\n/g
And when I am unshure what happens I write
$_ = $string;
s/\r\n/\n/g;
print;
$string = $_;
Hope this helps.
-Dmitry
>
> If I use an extern DOS-to-UNIX utility on the file and save it's OK. (I'm
> working on WINDOWS)
>
> But I want to export by the perl script so I don't have to change it.
>
> can someone help me
>
> roderikvalcke@unicall.be
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 10 Nov 1998 08:09:53 GMT
From: tore@forumnett.no (Tore Aursand)
Subject: Enjoy the power of newsgroups (Was: newbie question)
Message-Id: <3647f450.488233122@news.online.no>
On 9 Nov 1998 19:50:01 GMT, gt6786b@acmey.gatech.edu (Jang Choe)
wrote:
>> It's amazing. The *exact same* question was asked a few days ago in the
>> thread "split and replace?????". Synchronicity?
> I don't know, the day I posted that question was like my first time in this
> newsgroup. Maybe I should of read every post before I posted huh?
You don't have to do the work all by yourself. Go to DejaNews [1],
choose "Power Search", enter "*perl*" in the "forum" input box, and
type your question. I will *guarantee* you an answer!
[1] <URL:http://www.dejanews.com/>
--
Tore Aursand
ForumNett Online AS
http://www.forumnett.no/
------------------------------
Date: Tue, 10 Nov 1998 12:46:07 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: EOF condition before actual EOF
Message-Id: <36482a53.11046076@news.ping.be>
aclamann@hotmail.com wrote:
>My question is, what can cause:
> (defined $line = <FILE>)
>to be false before the end of file is reached?
This:
>I am using:
>Perl version 5.005_02 built for MSWin32-x86-object
Nothing wrong with the Perl build (I hope); it's the platform that's
causing you problems. This goes back to the DOS text mode of reading
files: as soon as this encounters a chr(26) (ctrl-Z), it treats this as
an end-of-file flag.
As Tom Phoenix already suggested: use binmode. This will probably also
prevent the conversion of CRLF to "\n", so you'll have to kill the CR's
yourself.
tr/\r//d;
or: us { tr/\r\n//d } instead of chomp. Or set $/ to "\015\012" before
starting to read your file, and do a chomp.
HTH,
Bart.
------------------------------
Date: Tue, 10 Nov 1998 12:14:39 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: File upload/Netscape4.0.7>
Message-Id: <36482E2F.6497A937@technologist.com>
Clinton Carr wrote:
>
> I just noticed that the CGI.pm file upload feature does not work in
> Netscape 4.0.7 or Netscape 4.5.
> Any workarounds?
>
> Thanks
I am using it on Communicator 4.5 without any problems. What is it
doing wrong???
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Tue, 10 Nov 1998 12:00:01 -0000
From: "Athula Herath" <Athula.Herath@ogs.co.uk>
Subject: Help! : a perl script to tranlating a file structure (pivoting/transposing)
Message-Id: <910699042.28931.0.nnrp-03.c2d9558d@news.demon.co.uk>
Hi,
I would like transform a table (a comma (or any other) delimited)
which has a structure similar to :
Col1, Col2, Col3
B1, 1, 0.3
B1, 2, 0.4
B1, 3, 0.3
B2, 1, 0.2
B2, 2, 0.2
B2, 5, 0.4
B2, 6, 0.1
[Table 1]
Into the following structure (pivoting or transpose is also
being used sometimes to describe this, I believe).
B1 B2
1, 0.3, 0.2,
2, 0.4, 0.2,
3, 0.3,
5, , 0.4,
6, , 0.1,
[Table 2]
As you see above, the columns of Table 1 is rearrange to
categorise the third column (in terms of Col1 and Col2).
I wonder whether anybody here can help me in coding a
perl script to do the above (or direct me to a source
where I can obtain one).
Many Thanks,
Athula.
Athula.Herath@ogs.co.uk
------------------------------
Date: Tue, 10 Nov 1998 05:05:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help, I'm stuck again (this one may push the envelope)
Message-Id: <Pine.GSO.4.02A.9811092103540.2742-100000@user2.teleport.com>
On Mon, 9 Nov 1998, Rusty Williamson wrote:
> I'm searching a file (arm_controls.h) for stuff like:
> START_ARMFS="true"
>
> and want to wind up with a hash containing:
> START_ARMFS, true, .....
If you don't have the Llama book yet, you should probably get it and work
through the exercises. This is easy to do with Perl's pattern matching;
see the perlre and perlop manpages. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 10 Nov 1998 12:46:09 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Help, I'm stuck again (this one may push the envelope)
Message-Id: <36492d74.11847487@news.ping.be>
Rusty Williamson wrote:
>grep -i '^start_' arm_controls.h | awk -F\" '{print $1 "," $2}'
>...
>
>I'm searching a file (arm_controls.h) for stuff like:
>START_ARMFS="true"
>
>and want to wind up with a hash containing:
>START_ARMFS, true, .....
That's easy, once you get into the right mindset.
@ARGV = 'arm_controls.h';
# unless you need @ARGV for something else...
while(<>) {
/^(start_\w+)\s*=\s*(.*?)/ and $hash{$1} = $2;
}
Or a more advanced version that will strip quotes:
while(<>) {
/^(start_\w+)\s*=\s*(.*?)/ or next;
for($hash{$1}=$2) { # $_ is an alias to $hash{$1}
s/^'(.*?)'.*/$1/ or s/^"(.*?)".*/$1/ or s/;.*//;
}
}
Tested with:
START_ARMFS="true";
START_MOTION = 0;
start_me_up = 'go, go, go!';
HTH,
Bart.
------------------------------
Date: Tue, 10 Nov 1998 18:16:34 +0800
From: "Ian Mc" <imcn@mpx.com.au>
Subject: Re: How to run perl scripts written in C++ on windows?
Message-Id: <7293pn$ggl$1@news1.mpx.com.au>
Jason Holland wrote in message <3645DD2F.A772F804@dial.pipex.com>...
>Dale Sutcliffe wrote:
>>
>> How to run perl scripts written in C++ on windows 98?
>>
>> perl scripts work fine, but now I want to create scripts in C++. how do
>> I do this?
>
You question is a bit like asking how do I write Chinese language scripts in
English.
C++ is a different language to Perl.
>}
------------------------------
Date: 10 Nov 1998 12:52:55 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Index of an element in a list?
Message-Id: <729cv7$knc$1@pegasus.csx.cam.ac.uk>
Colin Kuskie <ckuskie@cadence.com> wrote:
>On 6 Nov 1998, Awrobinson wrote:
>
>> Is there a built-in or effiecient way to determine the index of an
>> element in a list? I used the lindex[] function all the time in tcl,
>> but I cannot find an equivalent in perl. I know I can build one with a
>> for loop or a foreach loop and a counter, but that seems inefficient.
>> It would really come in handy for the project I'm working on now.
>
>I'm going to make the dangerous carte-blanche statement:
>
>"Unless your data is sorted, there is no way to improve on the linear
>search."
Yes and no. If only one (or very few) lookup is to be done, that's true.
But if you're doing many lookups in the same array, a hash indexing the
array will be much faster.
Also consider whether you need the array at all. You can always
reconstruct it from the keys of the index hash.
Mike Guy
------------------------------
Date: Tue, 10 Nov 1998 10:32:26 GMT
From: peter@helpnet.com.au (Peter)
Subject: Is there a compiler for Perl?
Message-Id: <364e0e22.13992984@news.flex.com.au>
Is there a compiler for Perl?
If not, does anyone know a similar language where I can convert Perl
to a compiled self contained .exe?
Peter
------------------------------
Date: Tue, 10 Nov 1998 12:12:17 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Learning Perl by video
Message-Id: <36482DA1.FB05D98B@technologist.com>
Randal, I see an "untapped" market here!
"Teach yourself Perl in 2 hours, unleashed for dummies" by RonCo.
Available in VHS and DVD.
Just in time for Christmas, only $19.95 plus $3.95 S&H.
Tim,
You question was a valid one, I just saw the opportunity to poke some
fun. To answer your question, no - I don't know of any commercially
available Perl training videos.
Honestly, if you go through the books and DO the example programs, that
is probably the __best__ training you can get. Pick a small project and
then do it, learning along the way. Once you have that done, find a
more difficult project.
I have found that it is much easier to learn it if you have a goal to
shoot for, rather than just trying to learn it all. With goals to shoot
for, you don't learn it all at once, but you learn more pieces with each
project. Then, in about a year you can go back and "revisit" your old
programs and fix all of the "silly" things you did wrong that you now
know how to do better.
Good luck!
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Tue, 10 Nov 1998 12:27:16 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Looking for a web site with good script examples
Message-Id: <36483124.B68121AF@technologist.com>
Hmmm,
Have you tried www.perl.com? I have always found useful information on
that site...
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Tue, 10 Nov 1998 10:11:43 GMT
From: pcbel@my-dejanews.com
Subject: mv -f in Perl
Message-Id: <7293gv$39s$1@nnrp1.dejanews.com>
Hi all,
Is it possible to do a "mv -f" in Perl? I need to move a lot of files, and I
don't want to start a new process for every "move:".
I could do a symlink/unlink, but I need to overwrite a file that is owned by
another user...
Any ideas?
Thanks!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 10 Nov 1998 11:20:22 GMT
From: jbharvey@corp.home.net
Subject: Re: mv -f in Perl
Message-Id: <WjV12.743$3o4.2765589@news.rdc1.sfba.home.com>
Would the function rename do the trick for ya?
-j
pcbel@my-dejanews.com wrote:
> Hi all,
> Is it possible to do a "mv -f" in Perl? I need to move a lot of files, and I
> don't want to start a new process for every "move:".
> I could do a symlink/unlink, but I need to overwrite a file that is owned by
> another user...
> Any ideas?
> Thanks!
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
Justin B. Harvey @Home Network
@Work Software Engineer 425 Broadway
jbharvey@corp.home.net Redwood City, CA 94063
Voice: (650) 569-5692 http://www.home.net
------------------------------
Date: Tue, 10 Nov 1998 09:28:34 +0000
From: Matt Sergeant <msergeant@ndirect.co.uk_NOSPAM>
Subject: Re: OLE Sub routine scalar assignment problem
Message-Id: <36480742.66E2AB49@ndirect.co.uk_NOSPAM>
John Hardy wrote:
>
> The problem I am having below is when the script reaches:
> $CMD->ActiveConnection=$Conn;
>
> PERL complains "Can't modify subroutine entry in Scalar assignment at line 95
> near "$Conn;" "
>
> I don't understand?? Can anyone tell me the proper way to do this??
$CMD->{ActiveConnection} = $Conn;
You're using an old kludge of accessing properties by function call that
will eventually be removed by the Win32::OLE module.
Also below in your code you do the same. You need to investigate
ActivePerl build 506 and the SetProperty function in the Win32::OLE
docs.
--
<Matt/>
| Fastnet Software Ltd | Perl in Active Server Pages |
| Perl Consultancy, Web Development | Database Design | XML |
| http://come.to/fastnet | Information Consolidation |
------------------------------
Date: Tue, 10 Nov 1998 11:09:09 -0000
From: "Phil Harris" <harrisp2@cf.ac.uk>
Subject: Re: Perl/Win'95
Message-Id: <36482c7a.0@d032>
When did you last look at AS perl, they have now integrated the Gurusamy
Sarathy perl and even hired him to get the Win32 perl closer to the
standard.
In actual fact the AS port is excellent, you will be hard pushed to find
scripts that don't work.
Erik <eln@cyberhighway.net> wrote in message
news:727ph4$nk1$1@news.cyberhighway.net...
>In article <3647236E.D763E906@patriot.net>,
> Marquis de Carvdawg <carvdawg@patriot.net> writes:
>> Perl runs on both 95/98 and NT. For the latest version of Perl for the
>> 32-bit Windows (ie, Win32) platforms, go to:
>>
>> http://www.activestate.com
>
>Bad, bad, bad. Win32 perl is included in the perl standard distribution,
>and it's a lot more likely to work with standard perl stuff (modules and
>such) than activestate's abomination. You can pick up binaries for it
>at www.perl.com if you don't have a C compiler.
>
>-- Erik Nielsen, Cyberhighway Internet Services NOC
>
>Not that I'm against sneaking some notions into people's heads upon
>occasion. (Or blasting them in outright.)
> -- Larry Wall in <199710211624.JAA17833@wall.org>
------------------------------
Date: Tue, 10 Nov 1998 12:25:41 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Perl/Win'95
Message-Id: <364830C5.EB190D4B@technologist.com>
Erik wrote:
> Bad, bad, bad. Win32 perl is included in the perl standard distribution,
> and it's a lot more likely to work with standard perl stuff (modules and
> such) than activestate's abomination. You can pick up binaries for it
> at www.perl.com if you don't have a C compiler.
>
> -- Erik Nielsen, Cyberhighway Internet Services NOC
Oh 'cmon, new we're bashing ActiveState?
I have been using ActiveStates __5.005x__ Perl now since it was
released. I use many different modules.
I have not run in to __any__ problems that relate back to ActiveState.
Can you name some specific problems that you have/had with the latest
release?
BTW: There were 2 binaries for Win23 system on Perl.com, both 5.004x.
One was by ActiveState and one by G.Surathay. Surathay is now
__working for ActiveState__ !
G.S. (Sorry if I butchered your name).
THANK YOU ACTIVESTATE for releasing a great ___FREE___ product!
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Mon, 9 Nov 1998 14:07:27 +0100
From: "Stephane Barizien" <NOSPAM.stephane.barizien@ocegr.fr>
Subject: pwd without backticks?
Message-Id: <7290th$ier1@janus.ocegr.fr>
Might sound a stupid question, but how to I get the current working
directory other than with:
$cwd = `pwd`;
which has the [performance] drawback of invoking a shell?
--
---
Stephane Barizien
Please remove the 'NOSPAM.' prefix when replying by e-mail.
Don't forget to cc: the newsgroup(s) in that case: others might
be interested in your answer!
------------------------------
Date: Tue, 10 Nov 1998 10:29:05 +0000
From: Dean Darlison <dean_darlison@dial.pipex.com>
Subject: Re: pwd without backticks?
Message-Id: <36481571.94FFE19A@dial.pipex.com>
Stephane Barizien wrote:
> Might sound a stupid question, but how to I get the current working
> directory other than with:
>
> $cwd = `pwd`;
>
> which has the [performance] drawback of invoking a shell?
>
in ksh/sh/(bash ?) the current directory is already held in the
environment variable $PWD
in csh/tcsh I think it is $cwd
Cheers,
Dean.
ps. Answer refers to Solaris 2.6 ( Any 'modern/sane' Unix should be no
different'
--
Dean.A.Darlison
Dasco Ltd.
------------------------------
Date: Tue, 10 Nov 1998 10:41:40 +0000
From: Dean Darlison <dean_darlison@dial.pipex.com>
Subject: Re: pwd without backticks?
Message-Id: <36481864.508EF57F@dial.pipex.com>
Whoops.
forgot to add:
print "Current dir : ", $ENV{'ENV'}, "\n";
cheers,
Dean.
--
Dean.A.Darlison
Dasco Ltd.
------------------------------
Date: Tue, 10 Nov 1998 11:10:52 +0100
From: Hendrik Woerdehoff <hendrik.woerdehoff@sdm.de>
Subject: Re: select case?
Message-Id: <3648112C.2208@sdm.de>
Bart Lateur wrote:
> What you must do is something like "if (){ .. } elsif () { ... }
> elsif..."
You mustn't use "must" in your statement. The blue camel shows seven (7)
different ways to solve this problem. You _can_ use "if ()", but then
there is always more than one way to do it...
Yours
Hendrik
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, Sec. 227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US (per infraction). E-mailing denotes acceptance of these terms.
--
Hendrik W"ordehoff |s |d &|m | software design & management
| | | | GmbH & Co. KG :
woerdehoff@sdm.de | | | | Thomas-Dehler-Str. 27 >B)
Tel/Fax (089) 63812-337/515 81737 M"unchen :
------------------------------
Date: Tue, 10 Nov 1998 12:44:06 GMT
From: nomam@my-dejanews.com
Subject: Re: Sorry Array-Hash-Problem
Message-Id: <729cem$9v1$1@nnrp1.dejanews.com>
In article <alecler-0911981406160001@dialup-695.hip.cam.org>,
alecler@cam.org (Andre L.) wrote:
> In article <727646$ece$1@nnrp1.dejanews.com>, nomam@my-dejanews.com wrote:
>
> [...]
> > %element = (
> > 'name' = $name,
> > 'size' = $size
> > );
> [...]
>
> You meant to use => instead of = here.
>
> HTH,
> Andre
Sorry for this mistype. Here's the whole, hopefully correct file:
#!/local/bin/perl5 -w
$count =0;
$startdir="/home/testuser/";
$fname;
@array;
opendir(DH,$startdir) || die("Kann $verzeichnissname nicht oeffnen!");
while (defined($name = readdir(DH))) {
if ($name =~ /[^.]/){
$count++;
push(@inhalt, $name);
}
}
closedir DH;
$count=1;
foreach $name (@inhalt) {
$fname = $name;
%eintrag = (
'name'=>$name,
'size' => $count,
);
print "$eintrag{'name'}:$eintrag{'size'}";
push (@array, \%Eintrag);
++$count;
}
print "\n\n";
foreach $fname (@array) {
print"$fname->{'name'} : $fname->{'count'}";
}
Thanks Andy
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 4187
**************************************