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

  • Re: Translate VBScript Which gets Computer Names to Perl
    ... If the script works in VBScript, why are you trying to translate it? ... Perl, I would use VBscript. ... perldoc -f push ...
    (microsoft.public.scripting.vbscript)
  • Re: Perl equivalent to unix script
    ... 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 ... perldoc -f open ...
    (comp.lang.perl.misc)
  • Re: How can I execute linux commands on terminal and catch the results?
    ... I'm learning perl and I need some help. ... I want to write a script that execute commands into a linux terminal ... perldoc -f system ...
    (perl.beginners)
  • Re: Getting started on perl on my PC
    ... You could use a typical "shebang" from Unix with no ... if you put your script on your Unix/Linux box or run Perl ... depending on your Windoze version). ...
    (comp.lang.perl.misc)
  • Re: calling a perl script on windows
    ... > perl ignores the first line of the script, and it seems I have to run the ... > if I run it like we do on unix: ... > it will search the path and it uses the perl found in the path env variable. ... Windows doesn't open and read the ...
    (perl.beginners)