[18916] in Perl-Users-Digest
Perl-Users Digest, Issue: 1111 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 11 18:06:50 2001
Date: Mon, 11 Jun 2001 15:05:20 -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: <992297120-v10-i1111@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 11 Jun 2001 Volume: 10 Number: 1111
Today's topics:
2-dimensional array into 1 dimensional array? (Bob)
Re: 2-dimensional array into 1 dimensional array? (Anno Siegel)
Re: 2-dimensional array into 1 dimensional array? <andras@mortgagestats.com>
Re: 2-dimensional array into 1 dimensional array? <pne-news-20010611@newton.digitalspace.net>
Re: Ack! Newbie still suffering from C-brain! <pne-news-20010611@newton.digitalspace.net>
Re: Ack! Newbie still suffering from C-brain! (Anno Siegel)
Re: Ack! Newbie still suffering from C-brain! (Tad McClellan)
Re: check if strings contain 2byte code <pne-news-20010611@newton.digitalspace.net>
Confusion on Win32-API <jhoerr@resnet.gatech.edu>
Re: Confusion on Win32-API <hillr@ugs.com>
cursor positioning (Mike)
DBD::ODBC or Win32::ODBC? <REMOVETHISPHRASEusenet@blacklettersoftware.com>
Re: Deleting old files <mbudash@sonic.net>
Re: File upload script <news@baxpace.com>
Getting the First Letter in string (TheLifePez)
Re: Getting the First Letter in string (Anno Siegel)
Re: Getting the First Letter in string <pne-news-20010611@newton.digitalspace.net>
Re: Getting the First Letter in string <rsherman@ce.gatech.edu>
Re: Getting the First Letter in string (Craig Berry)
Re: Getting the First Letter in string <jurgenex@hotmail.com>
Re: Help Passing Variables nobull@mail.com
Re: Help Passing Variables <gamtci@mpinet.net>
Re: Help Passing Variables <pne-news-20010611@newton.digitalspace.net>
Re: Help Passing Variables (Steven)
Re: How to send an email and have the result ? <pne-news-20010611@newton.digitalspace.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jun 2001 11:50:55 -0700
From: rabell@co.riverside.ca.us (Bob)
Subject: 2-dimensional array into 1 dimensional array?
Message-Id: <107fafaf.0106111050.4d3b2bfb@posting.google.com>
I have a 2-dimensional array (array of arrays) that I want take the
contents of one "row" of the array and store in another 1 dimensional
array. As follows...
#create the 2 dimensional array
@test_array = (['3rd', '2nd', 'a'],
['3rd', '1st', 'b'],
['3rd', '2nd', 'c'],
['2nd', '1st', 'a'],
['1st', '1st', 'b'],
['1st', '1st', 'a']);
# (Attempt to) grab the contents of "row" 2.
@zork = $test_array[2];
# Display the new array.
print $zork[0], "\n";
print $zork[1], "\n";
print $zork[2], "\n";
The "print" command returns nothing recognizable/usable.
This looks like it should be easy, and I'm probably missing something
obvious.
Thanks in advance.
Bob
------------------------------
Date: 11 Jun 2001 19:15:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: 2-dimensional array into 1 dimensional array?
Message-Id: <9g35dd$gca$1@mamenchi.zrz.TU-Berlin.DE>
According to Bob <rabell@co.riverside.ca.us>:
> I have a 2-dimensional array (array of arrays) that I want take the
> contents of one "row" of the array and store in another 1 dimensional
> array. As follows...
>
> #create the 2 dimensional array
> @test_array = (['3rd', '2nd', 'a'],
> ['3rd', '1st', 'b'],
> ['3rd', '2nd', 'c'],
> ['2nd', '1st', 'a'],
> ['1st', '1st', 'b'],
> ['1st', '1st', 'a']);
>
> # (Attempt to) grab the contents of "row" 2.
> @zork = $test_array[2];
You are missing a step of dereferencing here. $test_array[2], being
an array element, can only hold a scalar value, namely a reference to
the array that holds the second row. Assigning this to the array
@zork does what always happens in this situation: the scalar is
assigned to $zork[0], otherwise @zork remains undefined.
To dereference $test_array[2], enclose it in {} and put the @ for
an array in front:
@zork = @{ $test_array[2]};
This assigns the contents of the third row to @zork, so the rest
of your code should now work as expected.
> # Display the new array.
> print $zork[0], "\n";
> print $zork[1], "\n";
> print $zork[2], "\n";
>
> The "print" command returns nothing recognizable/usable.
It printed the stringified version of an array ref. While it may
indeed be not very useful, the pattern is worth memorizing. When
you see it, you may assume that you have treated an arrayref as
a string, which is valuable debugging information.
Anno
------------------------------
Date: Mon, 11 Jun 2001 15:15:07 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: 2-dimensional array into 1 dimensional array?
Message-Id: <3B2518BB.B4AEFE7F@mortgagestats.com>
Bob wrote:
> I have a 2-dimensional array (array of arrays) that I want take the
> contents of one "row" of the array and store in another 1 dimensional
> array. As follows...
>
> #create the 2 dimensional array
> @test_array = (['3rd', '2nd', 'a'],
> ['3rd', '1st', 'b'],
> ['3rd', '2nd', 'c'],
> ['2nd', '1st', 'a'],
> ['1st', '1st', 'b'],
> ['1st', '1st', 'a']);
>
> # (Attempt to) grab the contents of "row" 2.
> @zork = $test_array[2];
Generally, if you have an @ at one side of an = and a $ at the other
side, you should get suspicious.
What you should keep in mind is that Perl arrays can only hold scalars.
In particular, @test_array is not really an array of arrays, it is an
array of array references. $test_array[2] is a reference to ['3rd',
'2nd', 'c'], which probably looks something like ARRAY(0xba58e8). You
should not think that it is "nothing recognizable/usable," though,
because you can dereference that reference to get back the original array
it refers to. What you need to do is this:
@zork = @{$test_array[2]};
Now @zork == ['3rd', '2nd', 'c']
>
------------------------------
Date: Mon, 11 Jun 2001 22:07:52 +0200
From: Philip Newton <pne-news-20010611@newton.digitalspace.net>
Subject: Re: 2-dimensional array into 1 dimensional array?
Message-Id: <v68aitoph8b213tdgphlokt04u1ocpupjj@4ax.com>
On 11 Jun 2001 11:50:55 -0700, rabell@co.riverside.ca.us (Bob) wrote:
> # (Attempt to) grab the contents of "row" 2.
> @zork = $test_array[2];
$test_array[2] is a reference to an array, not an array. To assign it to
an array, you need to dereference it:
@zork = @{ $test_array[2] };
> This looks like it should be easy, and I'm probably missing something
> obvious.
Suggested reading: perldsc, perlreftut, perllol.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 11 Jun 2001 21:19:47 +0200
From: Philip Newton <pne-news-20010611@newton.digitalspace.net>
Subject: Re: Ack! Newbie still suffering from C-brain!
Message-Id: <fb6ait4dahvjfa3uvgbnjfo7354gk7bkbi@4ax.com>
On 11 Jun 2001 16:23:04 GMT, dha@panix.com (David H. Adler) wrote:
> In article <7V0V6.1401$h45.8042@news.uk.colt.net>, John Imrie wrote:
> >
> > pt <mnemotronic@mind\no-spam/spring.com> wrote in message
> > news:3B244F86.1BCB14B0@mindspring.com...
> >> After taking a few steps back, it appears that much of my Perl code
> >> resembles Pascal/C/C++/Java/etc. I just read about foothing (i.e.
> >> *foo{THING}), the "each" operator and pseudohashes. The more I read,
> >> the more interesting doohickies turn up. How long does it take to BEGIN
> >> {<PERLISH> =~ /thinking/}
> >>
> > You know you are thinking in perl when you use foreach instead of for
>
> ...and moreso when you start using for, but as a synonym for foreach,
> rather than as a C-style for loop. :-)
I agree. Most of my foreach-es are spelled "for", especially if I use $_
as the default loop variable.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 11 Jun 2001 19:40:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Ack! Newbie still suffering from C-brain!
Message-Id: <9g36rv$gca$3@mamenchi.zrz.TU-Berlin.DE>
According to Philip Newton <nospam.newton@gmx.li>:
> On 11 Jun 2001 16:23:04 GMT, dha@panix.com (David H. Adler) wrote:
>
> > In article <7V0V6.1401$h45.8042@news.uk.colt.net>, John Imrie wrote:
> > >
> > > pt <mnemotronic@mind\no-spam/spring.com> wrote in message
> > > news:3B244F86.1BCB14B0@mindspring.com...
> > >> After taking a few steps back, it appears that much of my Perl code
> > >> resembles Pascal/C/C++/Java/etc. I just read about foothing (i.e.
> > >> *foo{THING}), the "each" operator and pseudohashes. The more I read,
> > >> the more interesting doohickies turn up. How long does it take to BEGIN
> > >> {<PERLISH> =~ /thinking/}
> > >>
> > > You know you are thinking in perl when you use foreach instead of for
> >
> > ...and moreso when you start using for, but as a synonym for foreach,
> > rather than as a C-style for loop. :-)
>
> I agree. Most of my foreach-es are spelled "for", especially if I use $_
> as the default loop variable.
...then you start looking[1] if it can be done with a statement-modifying
"for".
Anno
[1] When you find yourself doing "do { ...} for @x;" you know you've
been trying too hard.
------------------------------
Date: Mon, 11 Jun 2001 16:32:21 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Ack! Newbie still suffering from C-brain!
Message-Id: <slrn9iaaml.d22.tadmc@tadmc26.august.net>
Philip Newton <pne-news-20010611@newton.digitalspace.net> wrote:
>On 11 Jun 2001 16:23:04 GMT, dha@panix.com (David H. Adler) wrote:
>
>> In article <7V0V6.1401$h45.8042@news.uk.colt.net>, John Imrie wrote:
>> >
>> > pt <mnemotronic@mind\no-spam/spring.com> wrote in message
>> > news:3B244F86.1BCB14B0@mindspring.com...
>> >> After taking a few steps back, it appears that much of my Perl code
>> >> resembles Pascal/C/C++/Java/etc.
>> > You know you are thinking in perl when you use foreach instead of for
>>
>> ...and moreso when you start using for, but as a synonym for foreach,
>> rather than as a C-style for loop. :-)
>
>I agree. Most of my foreach-es are spelled "for", especially if I use $_
>as the default loop variable.
I disagree. I don't like overloading, is slows down comprehension
while I resolve which usage it is.
I always use "foreach" for the "walk across a list" thingie.
I always use "for" for the "three part C-like" thingie.
I know I'm thinking in (maintainable) Perl when I type the
longer one a lot more often than the shorter one. (so I
agree on that part)
Perhaps I'm just better at typing than at comprehension though. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 11 Jun 2001 22:07:54 +0200
From: Philip Newton <pne-news-20010611@newton.digitalspace.net>
Subject: Re: check if strings contain 2byte code
Message-Id: <of8ait0fqrbbv6b2mdcd63ft6volf7bi88@4ax.com>
On 12 Jun 2001 01:43:34 GMT, s11976@net2.hkbu.edu.hk (Pui Ming WONG)
wrote:
> I would like to check if a string contains 1 or more chinese characters
Use a regex that matches them :-)
> (i.e. big5 code which is 2byte code).
According to _CJKV Information Processing_, Big5 text matches the
following:
m{
^ # start-of-string
(?: # one-or-more-of
[\x00-\x7F] # ASCII / CNS-Roman
| # or
[\x81-\xFE][\x40-\x7E\xA1-\xFE] # Big5
)+
\z # end-of-string
So if you just want to find the Chinese characters, then something like
/[\x81-\xFE][\x40-\x7E\xA1-\xFE]/
should match, if they are encoded in Big5. This finds at least one
character.
Note, however, that this may also match Latin1 text, or Japanese text in
Shift-JIS or EUC-JP encoding, or Korean text in EUC-KR encoding, or
other things.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 11 Jun 2001 14:15:14 -0400
From: "John Hoerr" <jhoerr@resnet.gatech.edu>
Subject: Confusion on Win32-API
Message-Id: <9g3265$431$1@iocextnews.bls.com>
I'm trying to incorporate the Win32-API module in my code, but it apparently
needs to be made first, or run through ppm install. I don't understand why
this module needs to be nmake'd when it already comes with a .pm file in the
zipfile -- it's my understanding that the .pm file is all perl needs to be
able to use the module, as these are all that are contained int the lib
directory.
i'm new to perl, but this seems sort of peculiar. am i missing something?
as it turns out, i'm unable to get both MicroSoft's nmake utility AND ppm to
work such that i can use ::API, so if someone could send me the 'compiled'
.pm file, i'd be really appreciative.
Please send it to jhoerr@mindspring.com.
Thanks!
john
------------------------------
Date: Mon, 11 Jun 2001 11:31:25 -0700
From: Ron Hill <hillr@ugs.com>
Subject: Re: Confusion on Win32-API
Message-Id: <3B250E7D.AEBA2B54@ugs.com>
John Hoerr wrote:
> I'm trying to incorporate the Win32-API module in my code, but it apparently
> needs to be made first, or run through ppm install. I don't understand why
> this module needs to be nmake'd when it already comes with a .pm file in the
> zipfile -- it's my understanding that the .pm file is all perl needs to be
> able to use the module, as these are all that are contained int the lib
> directory.
>
> i'm new to perl, but this seems sort of peculiar. am i missing something?
>
> as it turns out, i'm unable to get both MicroSoft's nmake utility AND ppm to
> work such that i can use ::API, so if someone could send me the 'compiled'
> .pm file, i'd be really appreciative.
try this
PPM> install Win32-API
Install package 'Win32-API?' (y/N): y
Installing package 'Win32-API'...
Bytes transferred: 12461
Installing H:\Perl\site\lib\auto\Win32\API\API.bs
Installing H:\Perl\site\lib\auto\Win32\API\API.dll
Installing H:\Perl\site\lib\auto\Win32\API\API.exp
Installing H:\Perl\site\lib\auto\Win32\API\API.lib
Installing H:\Perl\html\site\lib\Win32\API.html
Installing H:\Perl\site\lib\Win32\API.pm
Writing H:\Perl\site\lib\auto\Win32\API\.packlist
PPM>
------------------------------
Date: Mon, 11 Jun 2001 21:56:24 GMT
From: mbowden@nj.rr.com (Mike)
Subject: cursor positioning
Message-Id: <3b293d79.1626653@news-server.nj.rr.com>
Does anybody know how to position the cursor on the screen under
Windows NT? I have tried Term::Cap, but can't get it to work. This
seems like a very basic problem ,but I can't find any solid
documentation on it, especially under NT.
------------------------------
Date: Mon, 11 Jun 2001 18:22:20 GMT
From: "Richard Biffl" <REMOVETHISPHRASEusenet@blacklettersoftware.com>
Subject: DBD::ODBC or Win32::ODBC?
Message-Id: <w%7V6.4092$Il5.514701@newsread1.prod.itd.earthlink.net>
What are the pros and cons of these modules? I'm using ActivePerl on Windows
2000, and Win98 may use the program too. I'll initially use the interface to
migrate data from a text file to a Paradox table, using nothing but INSERT
statements, but maybe I'll do more with it later. I've seen a post here
saying that DBD::ODBC is preferred, but ActiveState's website mentions that
Win32::ODBC is popular.
Richard
------------------------------
Date: Mon, 11 Jun 2001 14:34:50 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Deleting old files
Message-Id: <mbudash-C16F8D.14345011062001@news.pacbell.net>
In article <3B1BE7CF.81D804ED@sky.net>, Steve <cochise@sky.net> wrote:
> Is there a way to delete files that are older that a certain time?
>
> I've got some temporary graphics whose names are based on the time that
> they were created using localtime.
>
> 991680688.gif
> 991679373.gif
> etc.
>
> At the moment I'm using:
>
> unlink <9*.gif>;
>
> and deleting them all.
>
> I would rather delete anything that is older than say 2 hours and keep
> the more recent files ... which would in turn be deleted later on in the
> day.
>
> Any help, or direction to the appropriate on-line resource, would be
> appreciated.
>
> Steve
the file test operator -M is your friend... type:
perldoc perlfunc
and scan for 'file test'
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Mon, 11 Jun 2001 20:33:44 +0100
From: Weevil <news@baxpace.com>
Subject: Re: File upload script
Message-Id: <9g36cs$ovn$1@plutonium.btinternet.com>
> I'm having trouble with a file upload script which uses cgi-lib.pl,
This is a newsgroup not IRC :) Tell us the problem!
--
Weevil
------------------------------
Date: 11 Jun 2001 19:06:37 GMT
From: thelifepez@aol.com (TheLifePez)
Subject: Getting the First Letter in string
Message-Id: <20010611150637.07443.00001407@ng-bd1.aol.com>
Hey, i have a question. I want to save the first letter in a string ($name) to
the variable $initial . Basically, what I want to do is have someone enter
their last name say, Smith and save the S from smith to a variable.
Thanks for any help.
------------------------------
Date: 11 Jun 2001 19:16:36 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Getting the First Letter in string
Message-Id: <9g35ek$gca$2@mamenchi.zrz.TU-Berlin.DE>
According to TheLifePez <thelifepez@aol.com>:
> Hey, i have a question. I want to save the first letter in a string ($name) to
> the variable $initial . Basically, what I want to do is have someone enter
> their last name say, Smith and save the S from smith to a variable.
perldoc -f substr
Anno
------------------------------
Date: Mon, 11 Jun 2001 22:07:53 +0200
From: Philip Newton <pne-news-20010611@newton.digitalspace.net>
Subject: Re: Getting the First Letter in string
Message-Id: <8b8aitsvmn09ca606cc35p66f4njf1qoms@4ax.com>
On 11 Jun 2001 19:06:37 GMT, thelifepez@aol.com (TheLifePez) wrote:
> Hey, i have a question. I want to save the first letter in a string ($name) to
> the variable $initial . Basically, what I want to do is have someone enter
> their last name say, Smith and save the S from smith to a variable.
The easiest way is probably substr. Tell substr to start from the
beginning of the string and only give you one character.
(Other methods include unpack 'a' and a regex like /^(.)/[1], but I'd
recommend substr for this.)
Cheers,
Philip
[1] any others I'm missing? chop reverse would also work if you used an
intermediate temporary variable.
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 11 Jun 2001 16:41:53 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Getting the First Letter in string
Message-Id: <3B24AE80.DEF2272B@ce.gatech.edu>
TheLifePez wrote:
> Hey, i have a question. I want to save the first letter in a string ($name) to
> the variable $initial . Basically, what I want to do is have someone enter
> their last name say, Smith and save the S from smith to a variable.
>
> Thanks for any help.
$name =~ /^\w{1}/;
$initial= $&;
the above assumes a normal value in $name...no leading white space or wierd
characters...
-rob
------------------------------
Date: Mon, 11 Jun 2001 21:23:21 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Getting the First Letter in string
Message-Id: <tiadm9r6o8m679@corp.supernews.com>
Philip Newton (pne-news-20010611@newton.digitalspace.net) wrote:
: On 11 Jun 2001 19:06:37 GMT, thelifepez@aol.com (TheLifePez) wrote:
: > Hey, i have a question. I want to save the first letter in a string ($name) to
: > the variable $initial . Basically, what I want to do is have someone enter
: > their last name say, Smith and save the S from smith to a variable.
:
: [1] any others I'm missing? chop reverse would also work if you used an
: intermediate temporary variable.
How about:
$first = (split //, $str)[0];
:)
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "God becomes as we are that we may be as he is."
| - William Blake
------------------------------
Date: Mon, 11 Jun 2001 14:49:46 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Getting the First Letter in string
Message-Id: <3b253cfb$1@news.microsoft.com>
"Robert Sherman" <rsherman@ce.gatech.edu> wrote in message
news:3B24AE80.DEF2272B@ce.gatech.edu...
> TheLifePez wrote:
> > Hey, i have a question. I want to save the first letter in a string
($name) to
> > the variable $initial . Basically, what I want to do is have someone
enter
> > their last name say, Smith and save the S from smith to a variable.
>
> $name =~ /^\w{1}/;
> $initial= $&;
Well, TIMTOWTDI, but why not use
$initial = substr $name, 0, 1;
jue
------------------------------
Date: 11 Jun 2001 19:12:43 +0100
From: nobull@mail.com
Subject: Re: Help Passing Variables
Message-Id: <u9snh63mxw.fsf@wcl-l.bham.ac.uk>
"John Morais" <jmorais@rochester.rr.com> writes:
> I am new to this Perl so here goes. I am converting a bunch of shell scripts
> to Perl that are executed by CRON. I am not having any problems converting
> the code but I have found any documentation that shows me how to pass a
> variable from the command line ...
>
> ie. Shell Script
>
> ./back_up_database.sh full
> where full is the backup type.
>
> I would like to do the following in Perl
>
> perl back_up_database.pl full
See the description of the special variable @ARGV in the perlvar manual.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 11 Jun 2001 20:00:18 GMT
From: Gary <gamtci@mpinet.net>
Subject: Re: Help Passing Variables
Message-Id: <3B2523A0.5F28@mpinet.net>
ARGV[0] is parameter 0 and so on...
------------------------------
Date: Mon, 11 Jun 2001 22:09:20 +0200
From: Philip Newton <pne-news-20010611@newton.digitalspace.net>
Subject: Re: Help Passing Variables
Message-Id: <fa9aitoh4bim51h12g0d0hce7u0v8ko38t@4ax.com>
[Please quote enough of the previous message to establish context.
Please attribute your quotes.]
On Mon, 11 Jun 2001 20:00:18 GMT, Gary <gamtci@mpinet.net> wrote:
> ARGV[0] is parameter 0 and so on...
$ARGV[0], not ARGV[0].
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 11 Jun 2001 14:47:38 -0700
From: steve.busiello@gs.com (Steven)
Subject: Re: Help Passing Variables
Message-Id: <fa45b871.0106111347.52e73576@posting.google.com>
You should also take a look at the GetOpt::Std implementation of passing arguments.
If you're from a unix bkgrnd, i am assuming you know C and getopts
http://search.cpan.org/doc/JHI/perl-5.7.1/lib/Getopt/Std.pm
-Steven
"John Morais" <jmorais@rochester.rr.com> wrote in message news:<6c7V6.182920$f85.27215541@typhoon.nyroc.rr.com>...
> I am new to this Perl so here goes. I am converting a bunch of shell scripts
> to Perl that are executed by CRON. I am not having any problems converting
> the code but I have found any documentation that shows me how to pass a
> variable from the command line ...
>
> ie. Shell Script
>
> ./back_up_database.sh full
> where full is the backup type.
>
> I would like to do the following in Perl
>
> perl back_up_database.pl full
>
> And the reaons I am converting to Perl to many Dang Oracle databases on NT
> now.
------------------------------
Date: Mon, 11 Jun 2001 22:07:49 +0200
From: Philip Newton <pne-news-20010611@newton.digitalspace.net>
Subject: Re: How to send an email and have the result ?
Message-Id: <1i6aitgr0biuolecpt00grehthpna57vrs@4ax.com>
On Mon, 11 Jun 2001 14:58:12 +0200, "CutMaster"
<cutmaster@fearlesss.com> wrote:
> How to send an email, in Perl, but with having the result of this send :
> (ie : fail to send, domain unavailable, etc).
TMTOWTDI, with varying degrees of simplicity and control about what you
know. `perldoc -q "send mail"` gives two suggestions:
- calling sendmail directly: this assumes the availability of sendmail,
or a drop-in replacement such as exim or, I believe, BLAT.EXE. This will
take care of retries, queuing, multiple mail exchangers in order of
preference, etc. for you, but will not tell you much about the success
or failure of the delivery (at least not by a return code AFAIK; you
might get a bounce in your mailbox).
- Mail::Mailer, which I know nothing about, but whose docs you can
peruse to determine whether it gives you enough information.
If you want to go the route of needless pain, you can also use Net::SMTP
directly; however, then you have to figure out a domain's mail
exchangers yourself (perhaps with Net::DNS), differentiate between
temporary and permanent SMTP errors, handle retries, and so on.
There are also assorted other mail modules available; have a look at
your favourite CPAN mirror.
Hope this helps some.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
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 1111
***************************************