my %hash = (); print "Enter File "; my $file_name = <>; chomp($file_name); open my $DATA, '<', $file_name or die "Cannot open file 2\n"; while (my $line = <$DATA>){ hash{file_path} = $line =~ /\/\/.*[#]/xms; #match "//" and them match everything until pound(#) hash{file_name) = $line =~ /[\/]+?(\w+)\#/xms; #Get the filename between last frontslash "/" and pound(#) hash{file_rev) = $line =~ /[#](\d+)/xms;#Match the number after pound (#) sign }