...But now m not able to open it.As it has file name so it should open the file but it is not. ...

So what is the error message that you get?

Your filename probably has extra characters you haven't accounted for, you can figure it out if you examine your data by Data::Dump::dd()umpering to visualize your data (lesson courtesy of Basic debugging checklist and brian's Guide to Solving Any Perl Problem )

This is how I'd start writing that, whatever it is

#!/usr/bin/perl -- ## whateveritis.pl ## 2015-04-17-02:31:50 ## ## ## ## ## ## perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce +-nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while " -otr + -opr -ce -nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while for " +-otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; Main( @ARGV ); exit( 0 ); sub Main { my $outfile = "/project/ls1socdft/user/pooja/test_plan_checker/dft +a/perl/parse_xls/script/result.log"; my $infile = "/project/ls1socdft_nobackup/rev2.0/user/Shah-B53654 +/dft/dfta/tpc/get_pat_info/output_0/report/report_all_wgl.pm"; my @final_array = SelectFinalFromInfile( $infile, $outfile ); SomethingElse( @final_array ); } ## end sub Main sub SelectFinalFromInfile { my( $infile, $outfile ) = @_; my $infh = path( $infile )->openr_raw; my $outfh = path( $outfile )->openrw_raw; my @final; while( <$infh> ) { next if m/^$/ or m/return/i or m/1;/; push @final, $_; print $outfh $_; } close $infh; close $outfh; return @final; } ## end sub SelectFinalFromInfile __END__

In reply to Re^5: Perl Script by Anonymous Monk
in thread Perl Script by Anonymous Monk

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.