Try this....
Regardsuse File::Copy; @files = qw(file1_name_051111.txt file2_name_051113.txt file3_name_051 +113.txt file4_name_051110.txt); foreach $fi (@files) { ($fol) = $fi =~m#(\d{6})\.txt#; mkdir $fol; copy("$fi", "$fol\\$fi"); unlink $fi; }
Franklin
Edit: g0n - corrected code tags
In reply to Re: get file name to create folder
by l.frankline
in thread get file name to create folder
by darrengan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |