Re: assigning contents to file name............
From: Jürgen Exner (jurgenex_at_hotmail.com)
Date: 02/06/04
- Previous message: rxl124_at_hehe.com: "assigning contents to file name............"
- In reply to: rxl124_at_hehe.com: "assigning contents to file name............"
- Next in thread: rxl124_at_hehe.com: "Re: assigning contents to file name............"
- Reply: rxl124_at_hehe.com: "Re: assigning contents to file name............"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 06 Feb 2004 09:54:44 GMT
rxl124@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
- Previous message: rxl124_at_hehe.com: "assigning contents to file name............"
- In reply to: rxl124_at_hehe.com: "assigning contents to file name............"
- Next in thread: rxl124_at_hehe.com: "Re: assigning contents to file name............"
- Reply: rxl124_at_hehe.com: "Re: assigning contents to file name............"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|