Hi: The following code ends up adding new line after each column/field in the record $record in FILE2.
#!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Find; use IO::All; my $path = $ARGV[0]; my $io = io($path); my @new = $io->all_files; #get all files under $path foreach $_ (@new) { $src = basename($_); #get only the filenames of the above files open FILE,">>$logfile"; print FILE $src; print FILE "\n"; } close FILE; open FILE,"+<$logfile"; @contents = <FILE>; foreach $src (@contents) { if(<for some bla condition1) { my $record = qq("<SH>/$src" "%HOME%/$src" "$src"\n); print FILE2 $record; } elsif(<for some bla condition 2){ ..... } } close FILE2; close FILE; So, instead of printing "<SH>/$src" "%HOME%/$src" "$src" in one single line, it prints each field of the record ie "<SH>/$src", "%HOME%/$src" and "$src" on a separate line.