Find the answer to your Linux question:
Results 1 to 2 of 2
I've got something pretty simple I need to do with a perl script but can't quite figure it out. I need to print something like the following: Code: print "thing1\n"; ...
  1. #1
    Linux User cheesecake42's Avatar
    Join Date
    Jan 2007
    Location
    Panama City, FL
    Posts
    364

    Basic Perl Redirect question

    I've got something pretty simple I need to do with a perl script but can't quite figure it out. I need to print something like the following:

    Code:
    print "thing1\n";
    print "thing2\n";
    print "thing3\n";
    I need the output of that piped into a file, however I can't simply do perlscript.pl > file.txt because there are other things that this script will be outputting that do not need to be piped to the file.

  2. #2
    Just Joined!
    Join Date
    Jul 2010
    Location
    Adelaide, Australia
    Posts
    3
    if you need to write data to a file, you should open a file handle and write to it using Perl, try reading the perldoc page on the open() function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...