Re: I'm sure this is a common question, but I can't find the solution.




Ron Smith wrote:
Hello all,

Hello,

How do you print elements of an array, each on its own
line, in a Windows' console?

I'm doing the following:

E:\My Documents>perl -e "use
ExtUtils::Installed; my $inst =
ExtUtils::Installed->new(); my @modules =
$inst->modules(); print @modules"

it returns:


Archive::TarArchive::ZipArray::CompareAutoLoaderCPANCPAN::ChecksumsCPAN::DistnameInfo
...etc.

I need:

Archive::Tar
Archive::Zip
Array::CompareAutoLoaderCPAN
CPAN::Checksums
CPAN::DistnameInfo ...etc.

I tried "\n", '\n' and a
'foreach' loop, but nothing I do seems to work.
..any suggestions?

I don't have Windows to test this on but this should
work:

perl -MExtUtils::Installed -le"my $inst =
ExtUtils::Installed->new(); print for
$inst->modules()"

Thanks, John. It does work. And, I've found that my original command also works when I added the -l and 'for' like:

perl -le "use ExtUtils::Installed; my $inst = ExtUtils::Installed->new(); my @modules = $inst->modules(); print for @modules"

I don't know if mine is correct form though. 'perl -h' reveals that -l enables line ending processing, specifies line terminator. Is that the idea?


Ron Smith
geeksatlarge@xxxxxxxxx
.



Relevant Pages

  • Re: threading question
    ... say I have a worker process processing in a loop ... Note that console apps very rarely show "Not Responding" because the Win32/64 console subsystem puts a layer between the application's input queue and the underlying windows message queue. ... A dotNet Console application become "native" console applications. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Splash Screens , how could something so basic still be hard?
    ... You say that there "is no message pump to allow for further GUI ... Note that by "there is no message pump", I mean that because of the way the code is written, no message pump is working while the "splash screen" is displayed. ... In a normal Forms app, there would be a message pump loop, and there's no reason to believe that in those examples, one doesn't exist. ... The same technique is possible in Windows, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CreateProcessAsUser - Process starts then exits
    ... Windows XP Media Center ... public Int32 dwX; ... public IntPtr lpReserved2; ... parent's console. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: CreateProcessAsUser - Process starts then exits
    ... service most likely runs in a separate invisible session. ... the program I was trying to start was a windows forms app I ... public IntPtr lpReserved2; ... parent's console. ...
    (microsoft.public.win32.programmer.kernel)
  • Novell Client login form enables reading and writing from and to the clipboard of the logged-in
    ... Novell Client for Windows, ... Anyone with access to the computer's local operating system console, ... inject its own textual content into the clipboard of the currently logged-in ...
    (Bugtraq)