Hello, I have written following perl code to sort file in subfolders according to regex matching its giving me following error while compiling the code.
Global symbol "@i" requires explicit package name at sortfiles.pl line 21. Global symbol "@i" requires explicit package name at sortfiles.pl line 30. Perl Code. #!/usr/bin/perl -w # Sorting file in to subdirs use integer; use File::Copy; use strict; my $base_dir="/home/gamesroot/meghanand/Lab1"; my $file_base="games-event.log2010"; my $i=0; my $j=$i+1; my @file1=""; my @file2=""; for(my $i=0;$i<6;$i++) { `mkdir $base_dir/$j`; @file1=`ls $base_dir/games-event.log2010-[0-9][0-9]-[0-9][0-9]_$i[0-4]*`; foreach(@file1) { chomp($_); `mv $_ $base_dir/$j`; } $j=$j+1; `mkdir $base_dir/$j`; @file2=`ls $base_dir/games-event.log2010-[0-9][0-9]-[0-9][0-9]_$i[5-9]*`; foreach(@file2) { chomp($_); `mv $_ $base_dir/$j`; } $j=$j+1; } Thanks in advanced. -- Regards, मेघानंद नं. आचरेकर Meghanand N. Acharekar " A proud Linux User " Reg Linux User #397975 ------------------------------------------ I was born free! No Gates and Windows can restrict my Freedom !!!