Discussion:
I'm sure this is a common question, but I can't find the solution.
Ron Smith
2009-03-15 06:49:54 UTC
Permalink
Subject: Re: I'm sure this is a common question, but I can't find the solution.
Date: Saturday, March 14, 2009, 10:51 PM
Ron,
On Sat, Mar 14, 2009 at 7:28 PM, Ron Smith
Hello all,
How do you print elements of an array, each on its own
line, in a Windows' console?
E:\My Documents>perl -e "use
ExtUtils::Installed; my $inst =
Archive::TarArchive::ZipArray::CompareAutoLoaderCPANCPAN::ChecksumsCPAN::DistnameInfo
...etc.
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?
Use the "join' command to join the elements of the
perl -e "use ExtUtils::Installed; my $inst =
$inst->modules(); print join
"\n\""
Yes, I tried 'join' also but ran into the following message on using more than 1 set of double quotes:

String found where operator expected at -e line 1, at end of line
(Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at -e line 1.

And, when I tried single quotes, I got:

Backslash found where operator expected at -e line 1, near "'\n\',@modules, '\"
(Missing operator before \?)
Backslash found where operator expected at -e line 1, near "n\"
syntax error at -e line 1, near "'\n\',@modules, '\"
Can't find string terminator "'" anywhere before EOF at -e line 1.


Ron Smith
***@yahoo.com
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
http://learn.perl.org/
David Christensen
2009-03-15 17:26:24 UTC
Permalink
Post by Ron Smith
Yes, I tried 'join' also but ran into the following message on using
Charles explains why:

http://www.mail-archive.com/beginners%40perl.org/msg99942.html


I use Windows, Linux, and BSD machines, and prefer working from the
command line. Over the years, I've tried several different Unix tool
chains, including Perl, on Windows. Cygwin seems to be the best
compromise. Understand that it breaks frequently, so save a copy of
your setup/ directory prior to every upgrade. I also started
downloading source tarballs, so I will have the option of sharing Cygwin
in compliance with the GPL. YMMV.


HTH,

David
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
http://learn.perl.org/
Chas. Owens
2009-03-15 17:48:10 UTC
Permalink
On Sun, Mar 15, 2009 at 13:26, David Christensen
Post by Ron Smith
Yes, I tried 'join' also but ran into the following message on using
   http://www.mail-archive.com/beginners%40perl.org/msg99942.html
I use Windows, Linux, and BSD machines, and prefer working from the
command line.  Over the years, I've tried several different Unix tool
chains, including Perl, on Windows.  Cygwin seems to be the best
compromise.  Understand that it breaks frequently, so save a copy of
your setup/ directory prior to every upgrade.  I also started
downloading source tarballs, so I will have the option of sharing Cygwin
in compliance with the GPL.  YMMV.
If you are stuck using Windows I would suggest looking into PowerShell
(née Monad)*. Microsoft got a bunch of smart people together and
reinvented the shell. It has full access to .Net and instead of just
piping lines of text around the pipes deliver objects (which can be
stringified for programs that don't understand objects). If it
weren't for the fact that it only runs on Windows I would probably use
it. One of its benefits is that it understands both single quotes and
double quotes, so many Perl one-liners can be copied directly to it
with out changes.

* http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
http://learn.perl.org/
David Christensen
2009-03-17 05:21:52 UTC
Permalink
Post by Chas. Owens
If you are stuck using Windows I would suggest looking into
PowerShell
...
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
Interesting. I don't have the time for coding that I used to, and I've found that it's easier if I stick to one tool chain. I've settled on GNU tools because they are available on Linux and on Windows via Cygwin.


David
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
http://learn.perl.org/
Continue reading on narkive:
Loading...