#!/usr/bin/perl use strict; use warnings; use Path::Tiny; use autodie; # die if problem reading or writing a file my $dir = path("/tmp"); # /tmp my $file = $dir->child("file.txt"); # /tmp/file.txt # Get a file_handle (IO::File object) you can write to # with a UTF-8 encoding layer my $file_handle = $file->openw_utf8(); my @list = ('a', 'list', 'of', 'lines'); foreach my $line ( @list ) { # Add the line to the file $file_handle->print($line . "\n"); }
In reply to Re: How to run a perl program from the Windows CMD?
by Anonymous Monk
in thread How to run a perl program from the Windows CMD?
by Stefany
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |