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

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

am 15.03.2009 07:49:54 von Ron Smith

> From: Beau E. Cox
> Subject: Re: I'm sure this is a common question, but I can't find the solution.
> To: geeksatlarge@yahoo.com
> Date: Saturday, March 14, 2009, 10:51 PM
> Ron,
>
> On Sat, Mar 14, 2009 at 7:28 PM, Ron Smith
> wrote:
> >
> > Hello all,
> >
> > 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::Ch ecksumsCPAN::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?
> >
>
> Use the "join' command to join the elements of the
> array with "\n":
>
> perl -e "use ExtUtils::Installed; my $inst =
> ExtUtils::Installed->new(); my @modules =
> $inst->modules(); print join
> \"\n\",@modules,
> "\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
geeksatlarge@yahoo.com

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

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

am 15.03.2009 18:26:24 von David Christensen

Ron Smith wrote:
> Yes, I tried 'join' also but ran into the following message on using
> more than 1 set of double quotes:

Charles explains why:

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


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-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/