What information from various unix/linux servers are you trying to get that isn't provided by "ls -l" ? Based on your code snippet, you're getting size, mod.date, and you want permissions too, and "ls -l" gives you all that (plus user and group ownership and link count).

If you have a list of servers to look at (e.g. in a file called "server.list" on your mswin machine), and a list of files to look for on each server (e.g. in separate files called "{servername}.filelist", also on the mswin machine), an easy way get what you want via a perl script on the mswin machine might be something like:

#!/usr/bin/perl # (standard shebang line, in case you get to use this on unix/linux so +meday) use strict; use warnings; open( SLIST, '<', "server.list" ) or die "server.list: $!\n"; while ( my $server = <SLIST>) { chomp $server; open( FLIST, '<', $server.filelist ) or do { warn "$server.filelist: $!\n"; next; } my $srvr_cmd = "ls -l"; while ( <FLIST> ) { chomp; $srvr_cmd .= " $_"; } my $file_info = `ssh $server $srvr_cmd`; print "=== results from $server ===\n$file_info\n"; }
You should be using a shell on the mswin machine that allows for redirection of stdout to a chosen file, or you can open an explicit output file in the perl script.

If you're trying to do something more complicated or subtle, and the above doesn't help with that, please be more explicit about what you're really trying to accomplish.


In reply to Re: run a perl script on a unix machine from a win machine by graff
in thread run a perl script on a unix machine from a win machine by akrrs7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.