Solved

Beginners question

Posted on 2001-06-29
3
166 Views
Last Modified: 2013-12-25
I am a beginner and this probably an extremely simple question, please excuse me.

How do I reverse a flatfiles contents, what I mean by reverse is this:

Existing flatfile contents.

1\n
2\n
3\n

What I want to convert it to is:

3\n
2\n
1\n

This is how I currently read the file:

open(FILE,"$dbase")
@all=<FILE>;
close(FILE);

0
Comment
Question by:haast
3 Comments
 
LVL 8

Accepted Solution

by:
bebonham earned 50 total points
ID: 6240246
open(FILE,"$dbase")
@all=<FILE>;
close(FILE);
@all=reverse @all;
open FILE, ">$dbaseReversed";
print FILE @all;
close FILE;


##the reverse function;

Bob
0
 
LVL 3

Expert Comment

by:rag2000
ID: 6240260
reverse the array
@reverseAll = reverse @all
0
 

Author Comment

by:haast
ID: 6240632
Thank you, it works fine.

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reading variable length EBCDIC in SAS 9 96
PowerShell Get-Help 10 68
Google  (Get  Users Email) 2 100
Questions about this React unit test 4 43
Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now