"Jürgen Exner" <ju******@hotmail.com> wrote in message news:<Ev******************@nwrddc01.gnilink.net>.. .
rx****@hehe.com wrote: how would you assign a contents to file in perl
What on earth do you mean by "assign a contents to file"?
i was thinking
$filename=`echo newvalue > filename`;
would work, but it does not, can someone please let me know what
i am missing?
part of the codes--------------------------------------------
Your code doesn't even compile!
#!/usr/bin/perl -w
$filename=`cat filename`;
print "\$filename has $filename \n";
if ($filename eq 'today') {
$file_value=tomorrow;
Unquoted string "tomorrow" may clash with future reserved word at ...
$filename=`echo tomorrow > filename`;}
else {
$file_value=today;
Unquoted string "today" may clash with future reserved word at ...
$filename=`echo today > filename`;
}
Are you simply trying to write something to a file?
Then you may want to read
perldoc -f open (pay particular attention the mode indicator)
perldoc -f print
perldoc -f close
jue
I am trying to do (task A) on one day and (Task B) on next
day(alternating).
I thought about how to do it, and thought that only way to do it would
be
to write what whether I did A or B and put that value into file(let's
say file_name, and put A since I did A today) and next day I would do
what's opposite based on what's in that file(file_name, since A is in
this file, I would now do B ). and run this for 24x7.....
I didn't want to run the open/print/close commands. Was just wondering
if there was simple way to do it or just use ` ` to excute unix
command and assign to the file name.