develooper Front page | perl.beginners | Postings from October 2009

Re: Am I doing something really stupid?

Thread Previous | Thread Next
From:
Shawn H Corey
Date:
October 13, 2009 07:20
Subject:
Re: Am I doing something really stupid?
Message ID:
4AD48CAF.3020509@gmail.com
"Am I doing something really stupid?"

No, asking for help is never stupid. :)

cknipe@savage.za.org wrote:
> 
> Hi,
> 
> I have the following code:
> #!/usr/bin/perl
> use diagnostics;
> use strict;
> use warnings;
> my @Files = </flows/ft*>;
> foreach my $File (@Files) {
>   print $File  "\n";

This print statement is treating $File as a file handle.  It is similar to:

  print STDERR "\n";

To get it to print the contents of $File, use a comma:

  print $File, "\n";

See: perldoc -f print  http://perldoc.perl.org/functions/print.html

> }


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About