sub parse{ my $path='\\'; my $computer = "LAIN"; foreach(@_) { # skip if it doesn't start with either a space or backslash next if (!/^[ \\]/); # check if path listing (starts with \) and if so, get the path if ($_=~/^(\\[\w|\s|\\]*\w+)/) { $path = $1.'\\'; } else { if (/^\s*(.*\S)\s{5,}([HDRSA]+)\s*(\d+)\s*(.*)/) { # dont include . or .. directories unless (($1 eq '.') or ($1 eq '..')) { my ($file,$att,$size,$date,$ext)=($1,$2,$3,$4); if ($file =~ /\.(.*)/) { $ext=$1; } else { $ext="DIR";} print "{$computer\:$path$file, $ext, $att, $size, $date }\n"; } } } } }