Hi Ratazong, I am a novice to perl thats why I do so much blunder. I tried another way to filter files. Instead using x2 z2 and all as variable I tried to search them as pattern. but it also having problem can you please check and tell what can I do so it may start working.

#usr/bin/perl use strict; use warnings; use File::Find; use File::stat; my $path='e:\testfolder'; find(\&checkFile, $path); # loop through all files in my directory #--------------------------------- check to be applied on each file -- +----------- sub checkFile { my $fullfilename = $File::Find::name; my $filesize = stat($File::Find::name)->size; my $filename = $_; # --- check for relevance based on expected filenames if ((! ($filename =~ /_obj_pp_comp.txt/ )) && (! ($filename =~ /ob +j.doc/ ))) { return; } if ($filesize == 0) { print ("<!-- \t\tERROR: file $fullfilename is empty. -->\n"); + return; } if (! -f $filename) { print ("<!-- \t\tERROR: file $fullfilename is a directory. -->\ +n"); return; } analyze($fullfilename); } #--------------------------------- work to be done on each relevant fi +le ------------- sub analyze { my @files = $fullfilename; my $pat='/^x2=0.[6-9][0-9][0-9][0-9][0-9]\n'; my $pat1='/^z2=0.[6-9][0-9][0-9][0-9][0-9]\n'; my $pat3='/^some_t2=0.[6-9][0-9][0-9][0-9][0-9]\n'; foreach my $file (@files) { foreach my $file1(@files) { foreach my $files2(@files) { if (($file=~/^$pat/) && ($file1=~/^$pat1/) && ($file2= +~/^$pat3/)) { print "$file IS VALID\n"; system 'mv $file E:\test\some' } else print "not relevant\n" } } } }


In reply to Re^2: filter the files in a folder on the basis of some variable present in them by reciter
in thread filter the files in a folder on the basis of some variable present in them by reciter

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.