#! /tools/perl/5.8.8/linux/bin/perl use strict; use warnings; print "Enter the name of the file to read: "; my $filetoread = ; chomp($filetoread); print "Enter the name of the file to write: "; my $filetowrite = ; chomp($filetowrite); open my $readhandle, "<", $filetoread or die "Unable to read '$filetoread'"; open my $writehandle, ">", $filetowrite or die "Unable to write '$filetowrite'"; my $name; my $path; while (<$readhandle>) { if ($_=~ m/^Name=(\S+)/) { $name = $1; print $writehandle $name; } if ($_=~ m/^Path=(\S+)/) { $path = $2; print $writehandle $path; } } close $readhandle; close $writehandle; #### Name=blocka Path=/main/sub/a/bg/adee/swarfrw/ewqsx/fewaxr/akeil/awedr/date/file