in reply to How do I create a file based on a variable?
Uhhh - do you want to read from the file or do you want to create that file? The code you have is for reading from that file, and you seem to say that reading works for you, so I assume that you also want to create the file and write to it. But that doesn't make sense, as you have no data to write to the file. So, let's create a different file with the number of timestamps. See the documentation for the open function.
use strict; my $user_status_output = "C:/temp/user_status.$user.out"; my @output = ( "Hello world", "This is a test", "And some more text to go into the output file" ); open my $out, ">", $user_status_output die "Failed to create output file '$user_status_output': $!"; for my $line (@output) { print $out "$line\n"; }; close $out; print "Wrote output to '$user_status_output'\n"; <c>
|
|---|