I know I am missing some very basic concepts (but that is why I am here). Trying to create a simple program that echoes entered text to a file (and stops when a blank line is entered).
So I wrote:
#!/usr/bin/perl
use strict;
use warnings;
my $file = "/path/to/some/file";
open ( FILE, '>', $file )
or die "Can't open $file for writing.\n";
while ()
{
<>;
last unless /\S/;
print FILE;
}
close FILE
or die "Can't close $file.\n";
But that just gets me:
Use of uninitialized value $_ in pattern match (m//) at...
Where and how do I initialize that?