"Sayed, Irfan (Irfan)" schreef:
> Following is the code which I am executing.
Missing:
use warnings ;
use strict ;
>
> my $fname3 = "/tmp/vob_repl_list_test1";
> open(FILE2, $fname3);
Missing: error checking.
open my $fh3, '<', $fname3 or die "open $fname3, stopped $!" ;
> my @vob_repl_list = <FILE2>;
> close(FILE2);
It might be a good idea to have a robust file2array() around, for
answers in this list.
Or is that too PHP?
First try:
#!/usr/bin/perl
# Script-ID: f2a.pl
use warnings ;
use strict ;
sub file2array ($\@;$)
{
my ($fname, $aref, $src_line) = @_ ;
my $fh ;
$src_line ? do {open $fh, '<', $fname
or die "line $src_line: open '$fname': $!\n"}
: do {open $fh, '<', $fname
or die "open '$fname': $!\n"} ;
@$aref = <$fh> ;
$src_line ? do {close $fh
or die "line $src_line: close '$fname': $!\n"}
: do {close $fh
or die "close '$fname': $!\n"} ;
return 1 ;
}
my @test ;
file2array $0, @test, __LINE__ or die ;
print @test, "\n" ;
file2array "$0.bad", @test or die ;
print @test, "\n" ;
__END__
> foreach my $a(@vob_repl_list)
> {
> `$MT chreplica -host puvob02 $a`;
> }
It is not a good idea to use $a or $b, see `perldoc perlvar`.
> I am not getting the proper value of $a in the command `$MT chreplica
> -host puvob02 $a`;
>
> I know that array @vob_repl_list is not empty.
Try again with warnings and strictures on, and always have them on from
now on.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>