Bass-Fighter has asked for the wisdom of the Perl Monks concerning the following question:
in this code stands 2 times: $ARGV[0]. I give the command in linux: perl program.txt perltst.#!usr/bin/perl use 5.6.1; use strict; use warnings; use Mail::Internet; use MIME::Parser; my $mail = Mail::Internet->new($ARGV[0]); my $headers = $mail->head()->header_hashref(); my $maximum = 100000; my $mailnummer = int(rand($maximum)); my $from = $headers->{From}->[0]; my $to = $headers->{To}->[0]; my $cc = $headers->{CC}->[0]; if ($cc eq ""){ $cc = 0; } my $date_time = $headers->{Date}->[0]; my $subject = $headers->{Subject}->[0]; if ($subject eq ""){ $subject = 0; } my $parser = MIME::Parser->new(); $parser->output_under('/tmp'); my $entity = $parser->parse($ARGV[0]); my $file; if ( $entity->is_multipart ) { for my $part ( $entity->parts ) { my $head = $part->head; if ( my $filename = $head->recommended_filename ) +{ $file = $filename; } } }
my information is inside perltst for this code. but with this form of the code this will only look at the "word" perltst itself.
in what way can I change $ARGV[0] to get there everything what is inside perltst?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using arguments
by Anonymous Monk on Dec 19, 2008 at 11:03 UTC | |
|
Re: using arguments
by dHarry (Abbot) on Dec 19, 2008 at 11:03 UTC | |
by Bass-Fighter (Beadle) on Dec 19, 2008 at 11:07 UTC | |
by dHarry (Abbot) on Dec 19, 2008 at 11:26 UTC | |
by Bass-Fighter (Beadle) on Dec 19, 2008 at 13:24 UTC | |
by dHarry (Abbot) on Dec 19, 2008 at 15:20 UTC |