#!/usr/bin/perl use warnings; ################################## # Output to a text file: ################################## $output1="j.txt"; open (my $fh1,">",$output1) or die"Cannot open file '$output1'.\n"; ################################## $a="John is"; $b="a good boy"; $join=$a.$b; # Concatenate print "\n Complete sentence:\n $join\n\n"; print $fh1 "\n Complete sentence:\n $join\n\n"; ####################################### # To input textfile j.txt from desktop: ####################################### open FILE,"j.txt" or die "Can't open file:$!"; while () { $new .=$_;} close FILE; print "\n Uploaded file content:\n $new\n\n"; exit; ######################### #### Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\x>cd desktop C:\Users\x\Desktop>m1.pl Complete sentence: John isa good boy Use of uninitialized value $new in concatenation (.) or string at C:\Users\x\Desktop\m1.pl line 30. Uploaded file content: