This script:

------- 8< snip ---------- 8< snip ---------- 8<snip ------- 
#!/usr/local/bin/perl
  
use strict;
use warnings;
  
my ($seven, $nine) = (stat('./SweetwatterPk-016.jpg'))[7, 9];
print "$seven and $nine\n";
------- 8< snip ---------- 8< snip ---------- 8<snip ------- 

Prints the desired fields of the stat array.  Now, how to reduce that
to the command line?

But these command line attempts fail:

(all on one line)
 perl  -e 'my ($seven, $nine) = 
    (stat('./SweetwatterPk-016.jpg'))[7, 9];
        print "$seven and $nine"'

output:
  syntax error at -e line 1, near "stat(."
  Search pattern not terminated at -e line 1.

-------        ---------       ---=---       ---------      -------- 

(all on one line)
 perl  -e 'my ($seven, $nine); if (($seven, $nine) =
   (stat('./SweetwaterPk-016.jpg'))[7, 9]){ print 
     "$seven and  $nine\n"}'

output:
  syntax error at -e line 1, near "stat(."
  Search pattern not terminated at -e line 1.

-------        ---------       ---=---       ---------      -------- 

What is the necessary syntax?


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to