last week I posted someting about using arguments. in 1 of those reactions of that is here the code again... but now what is in the file too

again the code:

#!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; } } }
and here what is inside perltst:
From from.someone@sent.com Wed Dec 3 09:36:43 2008 Return-Path: <from.someone@sent.com> Received: from [19.168.20.16] ([19.345.456.12]) by mail2.ibb.nl (9.22.41.45678901/3.15.10) with ESMTP id mB56a +hFCh20714; Wed, 3 Dec 2008 09:36:43 +0100 Message-ID: <34567890.12345678@sent.com> Date: Wed, 03 Dec 2008 09:36:55 +0100 From: someone <from.someone@sent.com> User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: perl@recieve.nl CC: zdf@cc.nl Subject: Test voor Michiel 's Perl programma Content-Type: multipart/mixed; boundary="------------000002060003020904090008" This is a multi-part message in MIME format. --------------000002060003020904090008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit hey, ben benieuwd of dit mailtje goed aankomt in het bestand. Groet, frits --------------000002060003020904090008 Content-Type: text/plain; name="Niet zelf een nummer bedenken!.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Niet zelf een nummer bedenken!.txt" SW4gZfafajkGAGEQRda789UIOKAJkljfqj8q8gdG9ldm9lZ2VuGAOGJHAFfagkl4538daj +a a3QgaGllcnZvb3IgQWRkSXRlbSBvZiBkZgBzdGFuZGFhcmQgcHJvZ3JhbW1hJ3MgdmFuIE +lC Qiag6FGIJ891rgahuClJCQQ== --------------000002060003020904090008--
the command in linux must be: perl emailprogramma3.txt perltst. and then the program will do everything automatically. at this moment the program will only look at the word perltst itself. but I want that the code above this will run through the program

I know that @ARGV[0] must be changed 2 times in the code, but who can tell me in what?

Bass-Fighter


In reply to loading files by Bass-Fighter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.