$temp = `Dir $your_directory_here`; if($temp =~ m/(\s+)(\d+)( File)(\S{3})(\s+)(\S+)( bytes)/i){ print "$6 bytes\n"; } #### ... if($temp =~ m/(\s+)(\d+)( bytes)/i){ ...