#!/usr/bin/perl use strict; use warnings; use diagnostics; use Math::Vector::Real; my $source = "./IN"; my $out = "./OUT"; open(IN, '<', $source) or die "Couldn't open $source: $!\n"; open(OUT, '>', $out) or die "Couldn't open $out: $!\n"; sub vector { my ($aa) = @_; $aa->[0] = my $one; $aa->[1] = my $two; $aa->[2] = my $three; my $vector = V($one, $two, $three); } my @data = map [ split ], grep /\S/, ; foreach my $d1 (@data) { print OUT " The vector of Atom ($d1->[0], $d1->[1], $d1->[2])is : %f\n", vector($d1); } close IN; close OUT; #### 0 5 5 1 2 3 3 5 6 2 5 2 5 5 5 5 5 6 #### mac95406:perl a7c$ ./perl Use of uninitialized value in join or string at /Library/Perl/5.16/Math/Vector/Real.pm line 219, line 6 (#1) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell you the name of the variable (if any) that was undefined. In some cases it cannot do this, so it also tells you what operation you used the undefined value in. Note, however, that perl optimizes your program anid the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program. #### sub as_string { "{" . join(", ", @{$_[0]}). "}" }