loop362 has asked for the wisdom of the Perl Monks concerning the following question:
foreach $name (@data) { print "$name"; }
This is names.txt#!/usr/bin/perl use strict; use warnings; my @data; my $name; open (JOE, "</Users/mrg/Desktop/names.txt") or die "No can!"; while (<JOE>) { @data = <JOE>; } foreach $name (@data) { print "$name"; }
This is the Ouput:Joseph.Guillaume Fred.Flintsone Barney.Rubble George.Jetson ElRoy.Jetson
Problem solved! by injunjoe Mahalo (Thank You)Last login: Wed Jul 23 13:44:11 on ttyp1 Welcome to Darwin! G4-2:~ mrg$ /var/tmp/folders.507/Cleanup\ At\ Startup/test-238549606.0 +74.pl.command; exit Fred.Flintsone Barney.Rubble George.Jetson ElRoy.Jetsonlogout [Process completed]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: foreach in array
by injunjoel (Priest) on Jul 24, 2008 at 00:04 UTC | |
by wade (Pilgrim) on Jul 24, 2008 at 00:13 UTC | |
|
Re: foreach in array
by broomduster (Priest) on Jul 24, 2008 at 00:20 UTC | |
|
Re: foreach in array
by ikegami (Patriarch) on Jul 23, 2008 at 23:34 UTC | |
|
Re: foreach in array
by Joost (Canon) on Jul 23, 2008 at 23:35 UTC | |
|
Re: foreach in array
by GrandFather (Saint) on Jul 23, 2008 at 23:40 UTC | |
|
Re: foreach in array
by toolic (Bishop) on Jul 23, 2008 at 23:52 UTC | |
|
Re: foreach in array
by linuxer (Curate) on Jul 23, 2008 at 23:35 UTC | |
by GrandFather (Saint) on Jul 23, 2008 at 23:59 UTC |