--- [EMAIL PROTECTED] wrote:
> 
> 
> All,
>      When I use strict function, I get an error in the following
> code.
> #!/usr/local/bin/perl
> use strict ;
> my @vob_list = `cleartool lsvob | grep "*"`;
> my $entry ;
> foreach $entry (@vob_list) {
> chomp $entry;
> my @fields = split /\s+/, $entry;

Watch these.....

> my $tag_list ;
> my $vbs_list ;
> @tag_list = @fields[1] ;
> @vbs_list = @fields[2] ;

See anything amiss?
You declared $tag_list, a scalar, but you're using @tag_list, and
array.
Since you never declared the array, it's looking for it as a global,
and there isn't one.


To fix
> foreach $lock (@tag_list) {

say:
 
 foreach my $lock (@tag_list) {

The same syntax works for the rest of these.

> print "$lock \n" ;
> foreach $tardir (@vbs_list) {
> print "$tardir \n" ;
> }
> }
> }
> 
> Global symbol "tag_list" requires explicit package name at ./back.pl
> line 10.
> Global symbol "vbs_list" requires explicit package name at ./back.pl
> line 11.
> Global symbol "lock" requires explicit package name at ./back.pl line
> 12.
> Variable "@tag_list" is not imported at ./back.pl line 12.
> Global symbol "tag_list" requires explicit package name at ./back.pl
> line 12.
> Variable "$lock" is not imported at ./back.pl line 13.
> Global symbol "lock" requires explicit package name at ./back.pl line
> 13.
> Global symbol "tardir" requires explicit package name at ./back.pl
> line 14.
> Variable "@vbs_list" is not imported at ./back.pl line 14.
> Global symbol "vbs_list" requires explicit package name at ./back.pl
> line 14.
> Variable "$tardir" is not imported at ./back.pl line 15.
> Global symbol "tardir" requires explicit package name at ./back.pl
> line 15.
> Execution of ./back.pl aborted due to compilation errors.
> 
> I get this error only when I use the strict function, so I figured
> that this is not an efficient code. Can somebody help me on this ?

It's just helping you get used to the way Perl works. =o)

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to