Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

when i save data in an array and th

Status
Not open for further replies.

kavi98

Programmer
Dec 14, 2000
48
US
when i save data in an array and then try to access it element wise ,what loop condition do i give to stop it.

#!/usr/local/bin/perl

sysopen SOURCE,openfil,2 or die "can't open file SOURCE ";
@_ = <SOURCE>;

while (<SOURCE>) {
foreach $line (@_) {
@element[$x] = split (/\t/,@_);

print &quot;@element[$x] \n&quot;;
$x++;
}
}
close SOURCE;
foreach $elem (@element) {
if ($elem =~m/,/) {
@elements = split (/,/,$elem);
}
}


 
Code:
my $loop = 1;
while ($loop)
{
  # do stuff in the loop which would
  # set $loop=0 when you want to stop
}
I also think break() or return() might work
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top