Perl Help

OK, I’m not a perl guy, but a few years ago, I wrote a simple littel
script that had email piped to it so that it could be processed and
inserted into a database when email is sent to a certain account.

The script reads in the email line by line like so:
while (<>) {
$line = $_;

process it all, etc.

}

That works.

Now I am trying to add a command line argument to it so that I can use
if for more than one email alias where I put the alias on the command
line. I can read that in by just getting it as $ARGV[0].

However, adding the command line argument (aliasname) produces the
following error, as if it’s trying to read in a file as aliasname:

Can’t open aliasname: No such file or directory at ./mail2web.pl line 35.

How can I do both where I can read in the command line argument and then
read in the data that is piped to it?

  • Gilby

Re: Perl Help

Solution found, replace the <> with <STDIN>.

  • Gilby

Gilby wrote:
> OK, I’m not a perl guy, but a few years ago, I wrote a simple littel
> script that had email piped to it so that it could be processed and
> inserted into a database when email is sent to a certain account.
>
> The script reads in the email line by line like so:
> while (<>) {
> $line = $_;
>
> # process it all, etc.
> }
>
> That works.
>
> Now I am trying to add a command line argument to it so that I can use
> if for more than one email alias where I put the alias on the command
> line. I can read that in by just getting it as $ARGV[0].
>
> However, adding the command line argument (aliasname) produces the
> following error, as if it’s trying to read in a file as aliasname:
>
> Can’t open aliasname: No such file or directory at ./mail2web.pl line 35.
>
> How can I do both where I can read in the command line argument and then
> read in the data that is piped to it?
>
> - Gilby

Re: Perl Help

glad I could be of service :slight_smile:


Rodney Blackwell

“Gilby” <mail@gilby.com> wrote in message
news:ckpd3d$b75$1@server1.darklock.com
> Solution found, replace the <> with <STDIN>.
>
> - Gilby
>
> Gilby wrote:
>> OK, I’m not a perl guy, but a few years ago, I wrote a simple littel
>> script that had email piped to it so that it could be processed and
>> inserted into a database when email is sent to a certain account.
>>
>> The script reads in the email line by line like so:
>> while (<>) {
>> $line = $_;
>>
>> # process it all, etc.
>> }
>>
>> That works.
>>
>> Now I am trying to add a command line argument to it so that I can use if
>> for more than one email alias where I put the alias on the command line.
>> I can read that in by just getting it as $ARGV[0].
>>
>> However, adding the command line argument (aliasname) produces the
>> following error, as if it’s trying to read in a file as aliasname:
>>
>> Can’t open aliasname: No such file or directory at ./mail2web.pl line 35.
>>
>> How can I do both where I can read in the command line argument and then
>> read in the data that is piped to it?
>>
>> - Gilby

Re: Perl Help

Rodney Blackwell wrote:
> glad I could be of service :slight_smile:
>

Yes, thank you Rodney, the master of perl.

  • Gilby

Re: Perl Help

“Gilby” <mail@gilby.com> wrote in message
news:ckpeu9$cbq$1@server1.darklock.com
> Rodney Blackwell wrote:
>> glad I could be of service :slight_smile:
>>
>
> Yes, thank you Rodney, the master of perl.

you forgot master of php, mysql, and all things technicalogical-like :slight_smile:


Rodney