FHEMWiki:Sandbox: Unterschied zwischen den Versionen
(test) |
Trelle (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
<div class="NavFrame"> | |||
<div class="NavHead">'''Title 1'''</div> | |||
<div class="NavContent"> | |||
<source lang="perl"> | <source lang="perl"> | ||
#!/usr/bin/perl | #!/usr/bin/perl | ||
Zeile 21: | Zeile 24: | ||
} | } | ||
</source> | </source> | ||
</div> | |||
</div> | |||
# SuperCode! | # SuperCode! | ||
# test | # test |
Version vom 3. März 2017, 18:36 Uhr
Title 1
#!/usr/bin/perl
use strict;
use warnings;
use Path::Class;
use autodie; # die if problem reading or writing a file
my $dir = dir("/tmp"); # /tmp
my $file = $dir->file("file.txt"); # /tmp/file.txt
# Get a file_handle (IO::File object) you can write to
my $file_handle = $file->openw();
my @list = ('a', 'list', 'of', 'lines');
foreach my $line ( @list ) {
# Add the line to the file
$file_handle->print($line . "\n");
}
- SuperCode!
- test