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!

How do I get a txt file into an array?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a text file that has a list numbers. What command do I need to use to read in each line of the file into an array varriable?

How would I code it to only put into the array numbers with the string "1234" contained in them?
 
Code:
open(IPF,&quot;<yourInputFile&quot;) or die &quot;Failed to open input file, $!&quot;;
while (<IPF>) { push @arrayOfLines, $_; }
close IPF;

'hope this helps [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top