[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] file tests



I've got a script that I am playing with that will take a file (i'll alter
it later for a directory) and describe it.  Name, kind, size, read, write
etc etc etc.  I've pasted the script below.  But as it is now, it will
print the file name, but NOTHING else.  AAAARGH!!!

As a person that knows what perl can do, hand fave made a few programs,
something like this which I haven't done before irritates me.  Would
somebody be willing to help me?

Thanks.....   --Tim

---BEGIN SCRIPT---
foreach (@ARGV) {
  $_ =~ s/.*:(.*)$/$1/;
  $NAME = $1;
  $READ = "YES" if -r _;
  $WRITE = "YES" if -w ITEM;
  $EXEC = "YES" if -x ITEM;
  $KIND = "FLDR" if -d ITEM; elsif $KIND = "FILE";
  $SIZE = -s ITEM;
  $LASTMODIFIED = -M ITEM;
  write;
}

format STDOUT_TOP =

NAME                                READ WRITE EXEC KIND   SIZE   LAST MODIFIED
------------------------------      ---- ----- ---- ---- -------- -------------
.

format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<      @>>> @>>>> @>>> @>>> @||||||| @>>>>>>>>>>>>
$NAME,$READ,$WRITE,$EXEC,$KIND,$SIZE,$LASTMODIFIED
.
---END SCRIPT---


again, thanks.

--------------------------------------------------------------------------------
"If the opposite of 'pro' is 'con' ...
    does that mean the opposite of 'progress' is 'congress'??"  -- Unknown
--------------------------------------------------------------------------------



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch