Re: Perl equivalent to unix script



Mike wrote:
Mike wrote:
Ok. . . Well, I'm sure here comes another dumb question. I'm fairly
handy with unix and unix scripting, however, I'm terrible at perl.

What I'm looking to do with a perl script is the equivalent of the
following unix (bash) script:

cat tempfile1 | sort > newfile2; rm tempfile1

I'm not completely comfortable with file handling in perl, and I think
it should be easy to do, but I've been unsuccessful in trying to do it.

Post what you've tried.


I'm essentially trying to sort the lines in a file (alphabetically),
and then output them to another file.


I guess I should have said that I don't want to handle this with a
system call either, I'd prefer to figure out, and learn how to do it
with purely perl.

If you want to figure it out, give the documentation a try.

perldoc -f open
perldoc -f sort
perldoc -f unlink
perldoc opentut

Helpful Web sites:

http://perldoc.perl.org/
http://bookmarks.cpan.org/search.cgi?cat=Training%2FTutorials
.



Relevant Pages