Solved

Beginners question

Posted on 2001-06-29
3
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
The viewer will learn how to count occurrences of each item in an array.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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