Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 exploiting the Monastery: (3)
As of 2024-07-14 23:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.