----- Original Message -----
From: Vladimir Lemberg <[EMAIL PROTECTED]>
Date: Tuesday, June 7, 2005 5:13 pm
Subject: problem with assigning a value

> Hi,
Hello
> 
> I have a problem with assigning value to string. I'll be really 
> grateful if someone will help me.
> 
> use strict;
> use warnings;
> use Cwd;
> use Term::ANSIColor qw(:constants);
> $Term::ANSIColor::AUTORESET = 1;
> 
> ####code fragment####
> 
> foreach (@dirs){
> chdir $_;
> my $curdir = cwd();
> my $vsn = glob ("*.vsn"); 
> my $ver = glob ("*.ver");
> 
> print BLUE "\n[$_]\n";
> 
> opendir(DIR, "$curdir") or die RED "Unable to open $curdir: $!";
>  while (defined (my $file = readdir DIR)) {
>    
>    next if -d "$curdir/$file" or $file eq "zone.cfg" or $file eq 
> $vsn or $file eq $ver;
>    
>    #compressing
>    system($program, $ARGV[0], $ARGV[1], $file) if $ARGV[0] eq "-c";
>    #decompressing
>    system($program, $ARGV[0], $file) if $ARGV[0] eq "-d";    
>  }
> 
> closedir(DIR);
> chdir $cwd;
> }
> 
> The problem is that on each even iteration of loop, strings my 
> $vsn and $ver cannot be initialized.
That is because you have already defined these variables outside of your loop. 
you can simpley say $vsn = "Fooooo" in your loop. By the way my 
$vsn = glob ("*.vsn"); may not due what you expact of it.
HTH,
mark G. 
> 
> Thanks in advance,
> Vladimir
> 
> 
> 
> 
> 
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to