[23063] in Perl-Users-Digest
Perl-Users Digest, Issue: 5284 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 29 03:05:58 2003
Date: Tue, 29 Jul 2003 00:05:10 -0700 (PDT)
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, 29 Jul 2003 Volume: 10 Number: 5284
Today's topics:
Re: Create electronic newsletters and email to all peop <NOSPAM@bigpond.com>
Re: Create electronic newsletters and email to all peop <dbcoordinator@cws.org.nz>
Re: Create electronic newsletters and email to all peop <dbcoordinator@cws.org.nz>
Re: Create electronic newsletters and email to all peop <NOSPAM@bigpond.com>
Re: Currying functions gregm@cs.uwa.edu.au
Re: Currying functions <grazz@pobox.com>
Re: hash problems <mihai.maris@alcatel.ro>
Re: hash problems <uri@stemsystems.com>
Re: hash problems <kkeller-spammmm@wombat.san-francisco.ca.us>
Help needed on mkdir <jimmykoo@pacific.net.sg>
Re: Help needed on mkdir <tony_curtis32@yahoo.com>
Re: Help needed on mkdir <grazz@pobox.com>
Help with parsing text file <kstairley@coppernospam.com>
Re: Help with parsing text file <grazz@pobox.com>
Re: How to do equivalent to Crypt:CBC of Perl in Oracle <member34391@dbforums.com>
Re: New to Perl - getting error <rpl-erroroneous@goldengate.net>
Re: New to Perl - getting error (Sam Holden)
Re: New to Perl - getting error <krahnj@acm.org>
New to Perl (Brett Irving)
Re: New to Perl <noreply@gunnar.cc>
Re: New to Perl (Tad McClellan)
perl problem on windows (Fong Tsui)
Re: perl problem on windows <me@verizon.invalid>
Re: perl problem on windows <mgarrish@rogers.com>
Re: perl problem on windows <me@verizon.invalid>
Re: Perl training resources? <mgarrish@rogers.com>
Re: Perl training resources? (Randal L. Schwartz)
Re: Perl variable data "replacement" <ducott@hotmail.com>
porting perl scripts from NT to UNIX <potnuru@students.uiuc.edu>
Problems with WWW::Mechanize and Amazon (Neil Thompson)
sort array of hash references <fake@do_not.use>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 Jul 2003 11:18:58 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Create electronic newsletters and email to all people in an excel spreadsheet
Message-Id: <bg4i1r$kn34c$1@ID-202028.news.uni-berlin.de>
"DB Coordinator for CS" <dbcoordinator@cws.org.nz> wrote in message
news:FujVa.95500$JA5.2100992@news.xtra.co.nz...
> Hi Guys
>
> We are using Windows platform and active perl in our organisation. We want
> to create electronic newsletters(which embed images as well) and want to
> mailout all the people whose email addresses are in an excel spreadsheet.
> Can you give some advice about what modules/items we should use in Active
> perl to create/mailout electronic newsletters?. How can we achieve this
> task?. Are there any particular way to do this in active perl?. What
> modules/sections of Active perl we should need?.Can you give some
reference
> or help?
>
> Thank you
> Jo
>
>
Heres a couple of simple examples of sending email as HTML using MIME::Lite.
You could put your newsletter in HTML format.
Also see http://search.cpan.org/dist/MIME-Lite/lib/MIME/Lite.pm
The easiest way to get the email addresses from Excel is cut/paste into
notepad.
#!/usr/bin/perl
use strict;
require MIME::Lite;
require MIME::Lite::HTML;
my $msg;
$msg = MIME::Lite->new(
To =>'user@bigpond.com',
From =>'newsletter@sadasdasd.com.au',
Subject =>'HTML with in-line images!',
Type =>'multipart/related'
);
$msg->attach(Type => 'text/html',
Data => qq{ <body>
Here's <i>my</i> image:
<img src="http://asdasd.com.au/images/asdasd.gif">
</body> }
);
$msg->send;
my $mailHTML = new MIME::Lite::HTML
From => 'MIME-Lite@alianwebserver.com',
To => 'user@bigpond.com',
Subject => 'test';
my $MIMEmail = $mailHTML->parse('http://asdsad.com.au');
$MIMEmail->send;
gtoomey
------------------------------
Date: Tue, 29 Jul 2003 16:06:17 +1200
From: "DB Coordinator for CS" <dbcoordinator@cws.org.nz>
Subject: Re: Create electronic newsletters and email to all people in an excel spreadsheet
Message-Id: <pnmVa.95687$JA5.2103808@news.xtra.co.nz>
"Gregory Toomey" <NOSPAM@bigpond.com> wrote in message
news:bg4i1r$kn34c$1@ID-202028.news.uni-berlin.de...
> "DB Coordinator for CS" <dbcoordinator@cws.org.nz> wrote in message
> news:FujVa.95500$JA5.2100992@news.xtra.co.nz...
> > Hi Guys
> >
> > We are using Windows platform and active perl in our organisation. We
want
> > to create electronic newsletters(which embed images as well) and want to
> > mailout all the people whose email addresses are in an excel
spreadsheet.
> > Can you give some advice about what modules/items we should use in
Active
> > perl to create/mailout electronic newsletters?. How can we achieve this
> > task?. Are there any particular way to do this in active perl?. What
> > modules/sections of Active perl we should need?.Can you give some
> reference
> > or help?
> >
> > Thank you
> > Jo
> >
> >
>
> Heres a couple of simple examples of sending email as HTML using
MIME::Lite.
> You could put your newsletter in HTML format.
> Also see http://search.cpan.org/dist/MIME-Lite/lib/MIME/Lite.pm
> The easiest way to get the email addresses from Excel is cut/paste into
> notepad.
>
>
> #!/usr/bin/perl
> use strict;
>
> require MIME::Lite;
> require MIME::Lite::HTML;
>
>
> my $msg;
> $msg = MIME::Lite->new(
> To =>'user@bigpond.com',
> From =>'newsletter@sadasdasd.com.au',
> Subject =>'HTML with in-line images!',
> Type =>'multipart/related'
> );
> $msg->attach(Type => 'text/html',
> Data => qq{ <body>
> Here's <i>my</i> image:
> <img src="http://asdasd.com.au/images/asdasd.gif">
> </body> }
> );
> $msg->send;
>
>
>
> my $mailHTML = new MIME::Lite::HTML
> From => 'MIME-Lite@alianwebserver.com',
> To => 'user@bigpond.com',
> Subject => 'test';
>
> my $MIMEmail = $mailHTML->parse('http://asdsad.com.au');
> $MIMEmail->send;
>
>
> gtoomey
>
>
------------------------------
Date: Tue, 29 Jul 2003 16:16:02 +1200
From: "DB Coordinator for CS" <dbcoordinator@cws.org.nz>
Subject: Re: Create electronic newsletters and email to all people in an excel spreadsheet
Message-Id: <vwmVa.95700$JA5.2104020@news.xtra.co.nz>
Thanks Greg. This really helped me. I couldn't install the MIME::Lite::HTML
module. I use ppm for module installation. I was able to install only
MIME::Lite.
Cheers
Jo
"Gregory Toomey" <NOSPAM@bigpond.com> wrote in message
news:bg4i1r$kn34c$1@ID-202028.news.uni-berlin.de...
> "DB Coordinator for CS" <dbcoordinator@cws.org.nz> wrote in message
> news:FujVa.95500$JA5.2100992@news.xtra.co.nz...
> > Hi Guys
> >
> > We are using Windows platform and active perl in our organisation. We
want
> > to create electronic newsletters(which embed images as well) and want to
> > mailout all the people whose email addresses are in an excel
spreadsheet.
> > Can you give some advice about what modules/items we should use in
Active
> > perl to create/mailout electronic newsletters?. How can we achieve this
> > task?. Are there any particular way to do this in active perl?. What
> > modules/sections of Active perl we should need?.Can you give some
> reference
> > or help?
> >
> > Thank you
> > Jo
> >
> >
>
> Heres a couple of simple examples of sending email as HTML using
MIME::Lite.
> You could put your newsletter in HTML format.
> Also see http://search.cpan.org/dist/MIME-Lite/lib/MIME/Lite.pm
> The easiest way to get the email addresses from Excel is cut/paste into
> notepad.
>
>
> #!/usr/bin/perl
> use strict;
>
> require MIME::Lite;
> require MIME::Lite::HTML;
>
>
> my $msg;
> $msg = MIME::Lite->new(
> To =>'user@bigpond.com',
> From =>'newsletter@sadasdasd.com.au',
> Subject =>'HTML with in-line images!',
> Type =>'multipart/related'
> );
> $msg->attach(Type => 'text/html',
> Data => qq{ <body>
> Here's <i>my</i> image:
> <img src="http://asdasd.com.au/images/asdasd.gif">
> </body> }
> );
> $msg->send;
>
>
>
> my $mailHTML = new MIME::Lite::HTML
> From => 'MIME-Lite@alianwebserver.com',
> To => 'user@bigpond.com',
> Subject => 'test';
>
> my $MIMEmail = $mailHTML->parse('http://asdsad.com.au');
> $MIMEmail->send;
>
>
> gtoomey
>
>
------------------------------
Date: Tue, 29 Jul 2003 14:40:24 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Create electronic newsletters and email to all people in an excel spreadsheet
Message-Id: <bg4tr4$ksudb$1@ID-202028.news.uni-berlin.de>
"DB Coordinator for CS" <dbcoordinator@cws.org.nz> wrote in message
news:vwmVa.95700$JA5.2104020@news.xtra.co.nz...
> Thanks Greg. This really helped me. I couldn't install the
MIME::Lite::HTML
> module. I use ppm for module installation. I was able to install only
> MIME::Lite.
>
> Cheers
> Jo
When I did this last your I installed the two modules in a local directory.
My ISP at the time did not have them installed.
gtoomey
------------------------------
Date: Tue, 29 Jul 2003 01:27:05 +0000 (UTC)
From: gregm@cs.uwa.edu.au
Subject: Re: Currying functions
Message-Id: <bg4ih9$4hc$1@enyo.uwa.edu.au>
In comp.lang.functional Dave Benjamin <dave@3dex.com> wrote:
: "Adrian Kubala" <adrian@sixfingeredman.net> wrote in message
: news:Pine.LNX.4.44.0307281409080.11405-100000@gwen.sixfingeredman.net...
:> On Mon, 28 Jul 2003, Dave Benjamin wrote:
:> > other languages like Python and Java use a more OO (and efficient) way
:> > of caching the pattern than using the method I described.
:> Why do you say "more efficient"
: All I was trying to say (and I didn't explain this very well) was that
: partial application does no actual computation, so if you partially apply a
: regex match function with a particular pattern (assuming pattern means a
: string, not a compiled regex), the regex could potentially be recompiled for
: each iteration.
That is probably the case for the Perl version (score one against
writing Perl in a functional style) but the Haskell version will
compile it the first time it is _used_ and then never again. That's
just as efficient in the general case and more efficient if your
list is empty.
-Greg
------------------------------
Date: Tue, 29 Jul 2003 02:51:32 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Currying functions
Message-Id: <UilVa.11747$AO6.6151@nwrdny02.gnilink.net>
In comp.lang.perl.misc gregm@cs.uwa.edu.au wrote:
> In comp.lang.functional Dave Benjamin <dave@3dex.com> wrote:
> : [...] partial application does no actual computation,
> : so if you partially apply a regex match function with
> : a particular pattern (assuming pattern means a string,
> : not a compiled regex), the regex could potentially be
> : recompiled for each iteration.
>
> That is probably the case for the Perl version (score one
> against writing Perl in a functional style)
Actually the Perl version will do the same thing either
way (recompile the regex whenever it changes).
However: the score is already so lopsided that this one
point isn't going to affect the outcome.
--
Steve
------------------------------
Date: Tue, 29 Jul 2003 07:30:42 +0300
From: Mihai Maris <mihai.maris@alcatel.ro>
Subject: Re: hash problems
Message-Id: <3F25F872.1C75F859@alcatel.ro>
I think I didn't have been well understood :
I KNOW THAT IN THIS FORUM ARE A LOT OF EXPERIENCED PROGRAMERS IN PERL.
I THOUGHT MAYBE THEY ALREADY ENCOUNTER THIS PROBLEM AND THEY JUST
CAN GIVE ME ANSWEAR.
IN THIS TIME WHEN I AM WAITING FOR THE ANSWEAR I CAN CONTINUE MY REGULAR JOB.
I WAS NOT TRYING TO SAY/MEAN FOR PEOPLE TO LOOK FOR ME IN THE FILES/FAQ/MANUALS .
SORRY FOR ANY ENCOVENIENCE.
Tad McClellan wrote:
> Mihai Maris <mihai.maris@alcatel.ro> wrote:
>
> > First of all : I'm a beginner in Perl.
>
> Nothing wrong with that.
>
> And an expert has just shown you how to get fast answers to
> common Perl questions.
>
> Getting fast answers to questions that are very likely to occur
> to you is a great benefit.
>
> You (could) have learned something valuable here...
>
> > And I found this a shortest way to find the
> > answeear to my problem.
>
> Posting to Usenet is the *longest* way to find an answer. It can take
> hours or days or even forever.
>
> Finding the answer in the docs that came with the software you are
> using, or in a newsgroup archive will much faster than typing up
> a question and hoping that someone sometime will answer it.
>
> > And I even didn't know about this FAQs
>
> Then a well-socialized response would have been:
>
> I didn't know about that, thanks.
>
> rather than whining about it.
>
> > and I also don't have so much time to
> > navigate throw.
>
> But we do?
>
> Asking thousands of people to read the docs to you is inefficient
> and wasteful.
>
> You have done serious damage to your ability to get help with any
> future Perl questions that you might have. So long.
>
> *plonk*
>
> [snip TOFU]
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Tue, 29 Jul 2003 04:36:27 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: hash problems
Message-Id: <x7zniyq790.fsf@mail.sysarch.com>
>>>>> "MM" == Mihai Maris <mihai.maris@alcatel.ro> writes:
MM> I think I didn't have been well understood :
you were well understood.
MM> I KNOW THAT IN THIS FORUM ARE A LOT OF EXPERIENCED PROGRAMERS IN
MM> PERL. I THOUGHT MAYBE THEY ALREADY ENCOUNTER THIS PROBLEM AND
MM> THEY JUST CAN GIVE ME ANSWEAR. IN THIS TIME WHEN I AM WAITING FOR
MM> THE ANSWEAR I CAN CONTINUE MY REGULAR JOB. I WAS NOT TRYING TO
MM> SAY/MEAN FOR PEOPLE TO LOOK FOR ME IN THE FILES/FAQ/MANUALS .
yes, and we all know the answer to your question which is in the FAQ. it
is a VERY COMMON QUESTION SO IT WAS WRITTEN UP IN THE FREQUENTLY ASKED
QUESTIONS FILE WHICH YOU CAN SEARCH THROUGH TO FIND YOUR ANSWER.
MM> SORRY FOR ANY ENCOVENIENCE.
WAS IT SO HARD FOR YOU TO SEARCH THE FAQ FOR THIS? OR USE GOOGLE.COM? OR
PERLDOC.COM? WAS THAT INCONVENIENT FOR YOU? OR IS JUST YOUR BEING
INCONVENIENT TO HUNDREDS OF PEOPLE MORE IMPORTANT?
whew, all that caps is hard on my shift fingers. :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 28 Jul 2003 22:03:43 -0700
From: Keith Keller <kkeller-spammmm@wombat.san-francisco.ca.us>
Subject: Re: hash problems
Message-Id: <f7v4gb.qao.ln@goaway.wombat.san-francisco.ca.us>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In article <3F25F872.1C75F859@alcatel.ro>, Mihai Maris wrote:
>
> I think I didn't have been well understood :
>
> I KNOW THAT IN THIS FORUM ARE A LOT OF EXPERIENCED PROGRAMERS IN PERL.
> I THOUGHT MAYBE THEY ALREADY ENCOUNTER THIS PROBLEM AND THEY JUST
> CAN GIVE ME ANSWEAR.
They gave you the answer. Did you look for it yet?
> IN THIS TIME WHEN I AM WAITING FOR THE ANSWEAR I CAN CONTINUE MY REGULAR JOB.
The answer is in the FAQ so that people can continue their regular job rather
than spend all their time answering the same questions every hour.
> I WAS NOT TRYING TO SAY/MEAN FOR PEOPLE TO LOOK FOR ME IN THE FILES/FAQ/MANUALS .
Since the answer is in the files/faq/manuals, why would anyone *not* tell you
to look there?
> SORRY FOR ANY ENCOVENIENCE.
Thus far you seem like the person most inconvenienced by your reluctance to
read the docs.
Good luck finding your answer.
[snip TOFU, again]
- --keith
- --
kkeller-mmmspam@wombat.san-francisco.ca.us
(try just my userid to email me)
alt.os.linux.slackware FAQ: http://wombat.san-francisco.ca.us/cgi-bin/fom
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAj8mACoACgkQhVcNCxZ5ID8iiwCbB4TGO+HVuBKefSJPlzLEWJ6e
/C8AoJe5IR+4VEIRKzQ/flzi9zLl80cz
=9YWD
-----END PGP SIGNATURE-----
------------------------------
Date: Tue, 29 Jul 2003 10:41:08 +0800
From: "Jimmy, Koo Yee Seong" <jimmykoo@pacific.net.sg>
Subject: Help needed on mkdir
Message-Id: <bg4ms3$mjv$1@nobel2.pacific.net.sg>
I understand that to create a directory, I use
mkdir ('directory',744);
but when i try to use a variable for directory it wont work...
like
$directory = "/home/new_directory";
mkdir ("$directory",744);
I need to use a variable to store the path to directory created as the
changes from time to time.
Will any kind people please help me out as this is quite urgent. thanks
alot.
Regards,
Jim
------------------------------
Date: Mon, 28 Jul 2003 21:52:29 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help needed on mkdir
Message-Id: <87k7a2doya.fsf@limey.hpcc.uh.edu>
>> On Tue, 29 Jul 2003 10:41:08 +0800,
>> "Jimmy, Koo Yee Seong" <jimmykoo@pacific.net.sg> said:
> I understand that to create a directory, I use mkdir
> ('directory',744); but when i try to use a variable for
> directory it wont work...
> like $directory = "/home/new_directory"; mkdir
> ("$directory",744);
You don't need the quotes, you're not interpolating
anything. Also the permissions are most easily expressed
as an octal numeral, not decimal: so 0744.
> I need to use a variable to store the path to directory
> created as the changes from time to time.
> Will any kind people please help me out as this is quite
> urgent. thanks alot.
Could be any of a number of things. Firstly let perl tell
you why:
mkdir($dir, 0755) or die "can't mkdir $dir: $!";
My 2 free guesses:
1. you're not root, or do not have suitable permissions.
2. you're running an automounter that is handling /home,
e.g. as on Solaris:
http://www.science.uva.nl/pub/solaris/solaris2.html#q3.4
hth
t
------------------------------
Date: Tue, 29 Jul 2003 03:11:37 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Help needed on mkdir
Message-Id: <JBlVa.11812$AO6.6933@nwrdny02.gnilink.net>
Jimmy, Koo Yee Seong <jimmykoo@pacific.net.sg> wrote:
> but when i try to use a variable for directory it
> wont work...
>
> like
> $directory = "/home/new_directory";
> mkdir ("$directory",744);
The fact that the first argument is a variable won't
make any difference.
You just need to add some error-checking:
mkdir($directory, 0755)
or die "mkdir: $directory: $!";
--
Steve
------------------------------
Date: Tue, 29 Jul 2003 02:16:36 -0400
From: "Kent" <kstairley@coppernospam.com>
Subject: Help with parsing text file
Message-Id: <3f26114c_3@athena.netset.com>
All,
I'm trying to parse a text file with logic that essentially goes like this:
1) open the file for reading with a handle
2) match for a regex (regular expression)
3) if found, get or print (to stdout or a file) the next few lines until a
blank line is found or a different regex is found
I can open the file for reading, no prob. - open (myhandle, <text_file>);
# or something like that
I can match the regex, no prob. - while ($myhandle =~ $regex) # or
something like this, sorry I don't have the code
in front of me and it's late. (But I can do this with the IO::Handle module)
But, how do I get the next few lines after I've matched the first regex?
I've looked at the getline(s) function
in the IO::Handle module and I couldn't get something like this to work:
(from the wrox press Perl prog. book)
$line = $fh->getline();
while ($fh->getline) {
print "$_ \n";
}
Any help would be appreciated.
TIA, Kent
(kstairley@copper.net)
------------------------------
Date: Tue, 29 Jul 2003 07:03:37 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Help with parsing text file
Message-Id: <d%oVa.13377$AO6.12850@nwrdny02.gnilink.net>
Kent <kstairley@coppernospam.com> wrote:
> I'm trying to parse a text file with logic that essentially
> goes like this:
> 1) open the file for reading with a handle
> 2) match for a regex (regular expression)
> 3) if found, get or print (to stdout or a file) the next
> few lines until a blank line is found or a different
> regex is found
Numbers two and three are an FAQ:
% perldoc -q 'between two patterns'
> I've looked at the getline(s) function
> in the IO::Handle module and I couldn't get something like
> this to work:
> (from the wrox press Perl prog. book)
> $line = $fh->getline();
> while ($fh->getline) {
> print "$_ \n";
> }
And here you'd need:
while ($_ = $fh->getline) { ... }
But that would be ooverkill.
Normally the loop looks like this.
while (<$fh>) { ... }
HTH
--
Steve
------------------------------
Date: Tue, 29 Jul 2003 05:35:57 +0000
From: nataraj <member34391@dbforums.com>
Subject: Re: How to do equivalent to Crypt:CBC of Perl in Oracle pl/sql
Message-Id: <3159371.1059456957@dbforums.com>
Ron,
Thanks for the reply.
Instead of installing something related to perl,
can I get a pl/sql procedure/function which can do the same work?
Basically, I should be able to encrypt/decrypt passwords through both
PERL and PL/SQL API.
I am not allowed to use perl in PL/SQL.
is there any alternative?
thanks,
Nataraj T Subbarao
Originally posted by Ron Reidy
> Look on CPAN for extproc-perl. Install (or have your DBA
> install); enjoy.
>
> nataraj wrote:
> ..
>
> --
> Ron Reidy
Oracle DBA
--
Posted via http://dbforums.com
------------------------------
Date: Mon, 28 Jul 2003 23:01:58 -0500
From: "Bob" <rpl-erroroneous@goldengate.net>
Subject: Re: New to Perl - getting error
Message-Id: <3f25f18b$0$102$8f4e7992@newsreader.goldengate.net>
John W. Krahn" <krahnj@acm.org> wrote in message
news:3F25A113.37BFFF08@acm.org...
> nos wrote:
> >
> > I am looking for a way to look into a file and determine the next
> > number in a sequence that is not present within a range of numbers.
> > Example:
> > File 10000
> > 10001
> > 10003
> > 10004
> >
> > I want it to find 10002 as the missing number. Any suggestions.
> perl -lne'print for $last + 1 .. $_ - 1; $last = $_' yourfile
> John
> --
> use Perl;
> program
> fulfillment
c:\tmp> perl -lne'print for $last + 1 .. $_ - 1; $last = $_' data
where data is file with 4 lines..
10001
10003
10004
10005
on w2k sp2 system - I get following error msg
Can't find string terminator "'" anywhere before EOF at -e line 1.
------------------------------
Date: 29 Jul 2003 04:04:55 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: New to Perl - getting error
Message-Id: <slrnbibsj7.vkt.sholden@flexal.cs.usyd.edu.au>
On Mon, 28 Jul 2003 23:01:58 -0500, Bob <rpl-erroroneous@goldengate.net> wrote:
>
> c:\tmp> perl -lne'print for $last + 1 .. $_ - 1; $last = $_' data
>
> where data is file with 4 lines..
> 10001
> 10003
> 10004
> 10005
>
> on w2k sp2 system - I get following error msg
> Can't find string terminator "'" anywhere before EOF at -e line 1.
perldoc -q one-liner
Why don't Perl one-liners work on my DOS/Mac/VMS system?
--
Sam Holden
------------------------------
Date: Tue, 29 Jul 2003 04:13:45 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: New to Perl - getting error
Message-Id: <3F25F4BB.AC444B5A@acm.org>
Bob wrote:
>
> John W. Krahn" <krahnj@acm.org> wrote in message
> news:3F25A113.37BFFF08@acm.org...
> > nos wrote:
> > >
> > > I am looking for a way to look into a file and determine the next
> > > number in a sequence that is not present within a range of numbers.
> > > Example:
> > > File 10000
> > > 10001
> > > 10003
> > > 10004
> > >
> > > I want it to find 10002 as the missing number. Any suggestions.
> > perl -lne'print for $last + 1 .. $_ - 1; $last = $_' yourfile
>
> c:\tmp> perl -lne'print for $last + 1 .. $_ - 1; $last = $_' data
>
> where data is file with 4 lines..
> 10001
> 10003
> 10004
> 10005
>
> on w2k sp2 system - I get following error msg
> Can't find string terminator "'" anywhere before EOF at -e line 1.
Sorry, I don't use Windows, but my understanding from reading the Perl
documentation is that you have to use " instead of ' when running on
Windows.
perl -lne"print for $last + 1 .. $_ - 1; $last = $_" data
John
--
use Perl;
program
fulfillment
------------------------------
Date: 28 Jul 2003 18:31:51 -0700
From: balgorg@hotmail.com (Brett Irving)
Subject: New to Perl
Message-Id: <4f68b81.0307281731.70f885c6@posting.google.com>
Hi I am new to perl and am trying to do some test functions that will
let me substitute html from one file into another using markers ie.
<HTML>
<HEAD>
</HEAD>
<BODY>
<!-- ***INSERT NEW CONTENT HERE*** -->
</BODY>
</HTML>
Is there any easy way I can go about doing this??
any help would be appreciated.
------------------------------
Date: Tue, 29 Jul 2003 03:40:57 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: New to Perl
Message-Id: <bg4jei$kp2o1$1@ID-184292.news.uni-berlin.de>
Brett Irving wrote:
> I am new to perl
What has that to do with your problem?
> and am trying to do some test functions that will let me substitute
> html from one file into another using markers
Let us see what you have done so far. Doing so will increase your
chances to get help.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 28 Jul 2003 22:46:11 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: New to Perl
Message-Id: <slrnbibrg3.2el.tadmc@magna.augustmail.com>
Brett Irving <balgorg@hotmail.com> wrote:
> let me substitute html
perldoc -q HTML
How do I remove HTML from a string?
> from one file into another
perldoc -q file
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?
> using markers
There are lots of templating systems already developed:
http://search.cpan.org/search?query=Template&mode=all
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Jul 2003 18:18:31 -0700
From: f.tsui@f5.com (Fong Tsui)
Subject: perl problem on windows
Message-Id: <e7ffa9a7.0307281718.e01a8ad@posting.google.com>
I have some difficulties to execute a command by using system() on
windows.
The command is like "$com1 -load $file1" and there are spaces in the
pathes of com1 and file1. For example, com1 and file1 both are located
in E:\Program Files. What I tried
1) system("$com1 -load $file1");
2) system("\"$com1\" -load \"$file1\");
The error message is "E:\Program is not recognized as an internal or
external command.
Does anybody know what did I do wrong and how to solve this?
Thank you very much,
Fong
------------------------------
Date: Tue, 29 Jul 2003 01:28:11 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: perl problem on windows
Message-Id: <L4kVa.19523$FP5.5834@nwrddc02.gnilink.net>
"Fong Tsui" <f.tsui@f5.com> wrote in message
news:e7ffa9a7.0307281718.e01a8ad@posting.google.com...
> I have some difficulties to execute a command by using system() on
> windows.
>
> The command is like "$com1 -load $file1" and there are spaces in the
> pathes of com1 and file1. For example, com1 and file1 both are located
> in E:\Program Files. What I tried
> 1) system("$com1 -load $file1");
> 2) system("\"$com1\" -load \"$file1\");
>
> The error message is "E:\Program is not recognized as an internal or
> external command.
>
> Does anybody know what did I do wrong and how to solve this?
have you tried:
system $com1, "-load", $file1
------------------------------
Date: Tue, 29 Jul 2003 03:23:53 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: perl problem on windows
Message-Id: <dNlVa.110419$zwL.58270@news04.bloor.is.net.cable.rogers.com>
"dw" <me@verizon.invalid> wrote in message
news:L4kVa.19523$FP5.5834@nwrddc02.gnilink.net...
>
> have you tried:
> system $com1, "-load", $file1
>
Depends on what you're trying to run. That will work for a bat or exe file
but not another perl script (just as examples). My advice would be to avoid
the whole issue if you can (i.e., use e:\progra~1\ unless there is a good
reason why progra~1 will not correspond to the Program Files directory).
Matt
------------------------------
Date: Tue, 29 Jul 2003 05:15:00 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: perl problem on windows
Message-Id: <opnVa.21285$FP5.19256@nwrddc02.gnilink.net>
"mgarrish" <mgarrish@rogers.com> wrote in message
news:dNlVa.110419$zwL.58270@news04.bloor.is.net.cable.rogers.com...
>
> "dw" <me@verizon.invalid> wrote in message
> news:L4kVa.19523$FP5.5834@nwrddc02.gnilink.net...
> >
> > have you tried:
> > system $com1, "-load", $file1
> >
>
> Depends on what you're trying to run. That will work for a bat or exe file
> but not another perl script (just as examples). My advice would be to
avoid
> the whole issue if you can (i.e., use e:\progra~1\ unless there is a good
> reason why progra~1 will not correspond to the Program Files directory).
>
It seems to work for me. Could it be a setup issue? This is what I get:
D:\path with spaces>type main.pl
#!d:\perl\bin\perl5.8.0.exe
print "in $0\n";
$other_pgm = "d:\\path with spaces\\other script.pl";
@args = qw(arg1 arg2 arg3);
system $other_pgm, @args;
print "done with $0\n";
exit 0;
D:\path with spaces>type "other script.pl"
#!d:\perl\bin\perl5.8.0.exe
print "in $0\n";
$x = 0;
printf "%3d : %s\n", $x++, $_ foreach ($0, @ARGV);
print "done with $0\n";
exit 0;
D:\path with spaces>main.pl
in D:\path with spaces\main.pl
in d:\path with spaces\other script.pl
0 : d:\path with spaces\other script.pl
1 : arg1
2 : arg2
3 : arg3
done with d:\path with spaces\other script.pl
done with D:\path with spaces\main.pl
D:\path with spaces>
------------------------------
Date: Tue, 29 Jul 2003 01:05:52 GMT
From: "mgarrish" <mgarrish@rogers.com>
Subject: Re: Perl training resources?
Message-Id: <QLjVa.109431$zwL.56076@news04.bloor.is.net.cable.rogers.com>
"William Fields" <Bill_Fields@azb.uscourts.gov> wrote in message
news:bg4dvr$s06$1@apollo.nyed.circ2.dcn...
>
> If there are no local Perl training resources in the Phoenix, Arizona
area,
> could someone suggest alternate training methods (CBT, videos, hands on
> books etc...)
>
Perl is a remarkably simple language to learn, and unlike some other
languages, the documentation tends to be very good (although sorely lacking
in practical examples at times, groups.google.com usually makes up for this
deficiency). A copy of Programming Perl is all you really need to get going
(plus the docs, see www.perldoc.com if you don't know where they are on your
computer). You probably won't get a whole lot more out of the O'Reilly books
(www.oreilly.com) that you can't get for free online, but if you prefer
reading from a book they're usually very good (I can't vouch for some of the
newer ones though, as the Tk book, in particular, is a bit of a rag). If you
want hands-on, just read the newsgroups, try solving the problems people
post and see how close your answers come to those that get posted.
Ultimately, you're only going to learn the language by playing with it, and
Perl lets you jump right into the deep end (whether that's a good thing or a
bad thing depends on how much common sense you have and how often you back
up your files).
Matt
------------------------------
Date: Tue, 29 Jul 2003 05:36:50 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: "William Fields" <Bill_Fields@azb.uscourts.gov>
Subject: Re: Perl training resources?
Message-Id: <09e959adb3e9302deeaaccc305a10bab@free.teranews.com>
>>>>> "William" == William Fields <Bill_Fields@azb.uscourts.gov> writes:
William> Funny guy. =P
William> If there are no local Perl training resources in the Phoenix,
William> Arizona area, could someone suggest alternate training
William> methods (CBT, videos, hands on books etc...)
As I sent you in email, we offer on-site Perl training courses
anywhere that we can reasonably travel, and have in fact delivered
many courses in the Phoenix area.
So there are indeed "local" Perl training resources. Just name the
date. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 29 Jul 2003 05:23:05 GMT
From: "\"Dandy\" Randy" <ducott@hotmail.com>
Subject: Re: Perl variable data "replacement"
Message-Id: <ZwnVa.548732$3C2.14183593@news3.calgary.shaw.ca>
> > I've seen Perl driven online forums perform such a task ... I've read
> > relevant perdoc's but have been unable to locate the solution. Ideas
and/or
> > examples welcomed! TIA!
>
> You should use URI::Find for this task. It comes with a subclass
> (URI::Find::Schemeless) that can be used for finding URIs that actually
> aren't URIs (such as 'www.host.com'):
>
> use URI::Find::Schemeless;
>
> my $u = URI::Find::Schemeless->new (
> sub { my $scheme = "http://" if $_[1] !~ m!^http://!;
> qq!<a href="$scheme$_[1]">$_[1]</a>! }
> );
>
> my $text = "please visit www.mysite.com";
>
> # this changes $text in-place
> $u->find(\$text);
>
> print $text;
> __END__
> please visit <a href="http://www.mysite.com">www.mysite.com</a>
>
> The above also adds a naive heuristic to see whether the URI scheme
> needs to be prepended to the address.
Tassilo, I wonder if this method would work with what I am trying to do. In
your code you define $text as a pre-determined value ... I need the code to
search a flatfile datasource (all lines) and replace all www addresses with
the needed html tags ... this data could change daily. Would this work:
use URI::Find::Schemeless;
my $u = URI::Find::Schemeless->new (
sub { my $scheme = "http://" if $_[1] !~ m!^http://!;
qq!<a href="$scheme$_[1]">$_[1]</a>! }
);
open (list, "<data.txt") or &error("Unable to open");
@list=<list>;
close(list);
my $text = @list;
# this changes $text in-place
$u->find(\$text);
print $text;
Let me know if you understand what I looking to do. thanx!
Randy
------------------------------
Date: Mon, 28 Jul 2003 20:35:51 -0500
From: mani srinivas potnuru <potnuru@students.uiuc.edu>
Subject: porting perl scripts from NT to UNIX
Message-Id: <Pine.GSO.4.31.0307282029080.9550-100000@ux13.cso.uiuc.edu>
Hi,
I am newbie to Perl in general. But i need to port a perl script which
uses WIN32 API to unix. I am wondering if anybody has some pointers about
how to go about this task.
Thanks!
Mani
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"It is better to keep your mouth shut and appear
stupid than to open it and remove all doubt."
--Mark Twain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mani S Potnuru
Research Assistant,
Dept. of Comp Sci & Beckman Institute
UIUC.
Ph (M) : 217-649-8841 (O-DCL) 217-333-5827 (O-BEC) 217-244-5883
------------------------------
Date: 28 Jul 2003 23:58:37 -0700
From: neil@williamsdb.zzn.com (Neil Thompson)
Subject: Problems with WWW::Mechanize and Amazon
Message-Id: <dba63fc7.0307282258.2d00403d@posting.google.com>
I am currently trying to get WWW::Mechanize to work and am struggling
with what I expected to be a simple example. I have managed to get
Mechanize working with Google but not with Amazon.
The following code runs but always opens a browser that displays an
Amazon pages stating that there has been a bug in my browser. This
occurs no matter what I set the Agent type to.
I want to use WWW::Mechanize to create a mobile version of a web
application I have and thought that Mechanize would be suitable but
I'm now not so sure if I cannot get it to work with something simple.
I would really apprecaite any pointers that anyone might have on what
the problem might be with the code or alternatives to Mechanize.
Thanks
Neil Thompson
#!/usr/bin/perl
# create a new browser
use WWW::Mechanize;
my $browser = WWW::Mechanize->new();
# tell it to get the main page
$browser->get("http://www.amazon.co.uk/");
die "failed to get www.amazon.co.uk ",
$browser->response->status_line
unless $browser->success;
# okay, fill in the box with the name of the
# module we want to look up
$browser->form_number(1);
$browser->field("field-keywords", "williams");
$browser->field("url", "index=books-uk");
$browser->click("Go");
die "failed to get click go ", $browser->response->status_line
unless $browser->success;
my $url = $browser->uri;
# launch a browser...
system('explorer.exe', $url);
# All done
exit;
------------------------------
Date: Tue, 29 Jul 2003 02:12:56 -0400
From: llama <fake@do_not.use>
Subject: sort array of hash references
Message-Id: <ehoVa.26405$o54.4571@lakeread05>
Hello,
I am trying to sort an array of hash references, like what is
returned by "statement_handle->fetchall_arrayref({})" when using
DBI. I cannot do the sort in the SQL call because I am sorting
from the results of two different SQL calls. Here is a code
snippet:
at this point I have two arrays of hash references, namely
"$membrows" and "$survrows". The first thing I do is put the
$membrows data into another hash keyed by "id". This is so
I can do the calculation in the second foreach loop (matching
data from the two datasets via 'id').
#start code fragment....
%membdata;
foreach $r (@$membrows) {
$membdata{$$r{'id'}} = $r;
}
#if sorting by
foreach $sr (@$survrows) {
$rid = $$sr{'id'};
$mr = $membdata{$rid};
$$sr{'notdone'} = $$mr{'tot'} - ($$sr{'finno'} + $$sr{'finyes'});
}
if ($sortby eq 'notdone') {
sort notdonesort @$survrows;
}
#.....at the end of the source file, notdonesort is defined:
sub notdonesort () {
return $$a->{'notdone'} <=> $$b->{'notdone'};
}
#....end code fragment
I've tried various anonymous and declared subroutines passed to
the sort statement and it never sorts. I know the "$$sr{'notdone'}="
is working because I can print out those calculated values later
along with the data that is originally in that hash. I want to
sort the array by those calculated values and I just can't seem to
tell sort about them correctly.
any help would be greatly appreciatee!
thanks.
andrew
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5284
***************************************