Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

conditional statement works one way, but not the other (Updated)

by igoryonya (Pilgrim)
on May 15, 2014 at 08:37 UTC ( [id://1086115]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if(@files && ! scalar keys %tree){$isChanged = 1;}
        else{foreach my $file (@files){$isChanged = 1 && last if( grep { $
    +files_cached{'stats'}{$file}{$_} != $params->{'files'}{'stats'}{$file
    +}{$_} } ('mtime', 'ctime', 'size') );}}
    
  2. or download this
    (@files && ! scalar keys %tree)?
        ($isChanged = 1):
        (foreach my $file (@files){$isChanged = 1 && last if( grep { $file
    +s_cached{'stats'}{$file}{$_} != $params->{'files'}{'stats'}{$file}{$_
    +} } ('mtime', 'ctime', 'size') )});
    
  3. or download this
    if(@files && ! scalar keys %tree){
        $isChanged = 1;
    ...
            $isChanged = 1 && last if( grep { $files_cached{'stats'}{$file
    +}{$_} != $params->{'files'}{'stats'}{$file}{$_} } ('mtime', 'ctime', 
    +'size') );
        }
    }
    
  4. or download this
    (@files && ! scalar keys %tree)?
        ($isChanged = 1):
        (map { my $file = $_; if( grep { $files_cached{'stats'}{$file}{$_}
    + != $params->{'files'}{'stats'}{$file}{$_} } ('mtime', 'ctime', 'size
    +') ){$isChanged = 1; last;} } @files);
    
  5. or download this
    (@files && ! scalar keys %tree)?
        ($isChanged = 1):
        (map { my $file = $_; $isChanged = 1 if( grep { $files_cached{'sta
    +ts'}{$file}{$_} != $params->{'files'}{'stats'}{$file}{$_} } ('mtime',
    + 'ctime', 'size') ) } @files);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1086115]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-23 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found