I am new to Perl, and have searched long and hard for the answer to this problem, but I am stuck.
Take the following example:
my $filein = $ARGV[0];
open(SNPIN,$filein);
while(<SNPIN>)
{
chomp;
split(/\s+/);
print "$_[0]\n";
}
close(SNPIN);
The test file that I am using has the following lines:
This is a test.
Is a test.
A test.
This script executes fine on our linux servers (with perl 5.10), outputting the first word of each line - although it gives me the following warning:
Use of implicit split to @_ is deprecated at scan_test.pl line 7.
but when I try to execute it on my local machine running OS X (with perl 5.12.3) I get the following error:
Useless use of split in void context at scan_test.pl line 7.
Use of uninitialized value $_[0] in concatenation (.) or string at
scan_test.pl line 8, <SNPIN> line 1.
Obviously this is a dummy script. I have inherited someone else's extremely long and complicated script which is working on our servers but I would like to develop it locally without having to go through the entire script and reassign all default variable calls to another variable. No matter what I have tried (including "use v5.10;"), nothing will allow me to use the default variable on my local machine.
Any ideas? Help is most appreciated.