Ask a Question related to PERL Miscellaneous, Design and Development.
-
Dave #1
Making a script write to a file (take 2)
G'day all
I'm trying to get a script to write (append) data to the bottom line
of a text file (*.dat). I know the variables I want to add but can't
do it.
I need to append something that looks like this...
$invoice|$date|Your Order has been received
Any suggestions would be helpful.
Cheers
Dave.
Dave Guest
-
Script Error after making changes
First, I am not a website designer. I own a website and have been making minor (text) changes using Contribute since I didn't need to know html. I... -
PDF-making Script
Is there a script to get pdfs made automatically? Currently, I am making pdfs by processing ad after ad by making a ps file and then dragging it into... -
Is it possible Write Script for text field in Illustrator?
Is it possible Write Script (condition) for text field in Illustrator 10? Is it possible to make any script that would check the date, or require... -
Making a script write to a file
G'day all -
edit and write multiple files with ed/ed/vi script
On 10 Aug 2003 18:30:59 -0700, chris <chris_piechowicz@hotmail.com> wrote: Hi, I am not quite sure if ed/ex/vi is the right tool for this job. I... -
John Bokma #2
Re: Making a script write to a file (take 2)
Dave wrote:
Is it possible that multiple processes add at the same time?> G'day all
>
> I'm trying to get a script to write (append) data to the bottom line
> of a text file (*.dat). I know the variables I want to add but can't
> do it.
> I need to append something that looks like this...
>
> $invoice|$date|Your Order has been received
>
> Any suggestions would be helpful.
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: [url]http://johnbokma.com/[/url] ICQ: 218175426
John web site hints: [url]http://johnbokma.com/websitedesign/[/url]
John Bokma Guest
-
Lao Coon #3
Re: Making a script write to a file (take 2)
[email]prometheus_au@excite.com.au[/email] (Dave) wrote in
news:526e114e.0309041747.7f0ec8aa@posting.google.c om:
Read perldoc perlopentut> G'day all
>
> I'm trying to get a script to write (append) data to the bottom line
> of a text file (*.dat). I know the variables I want to add but can't
> do it.
> I need to append something that looks like this...
>
> $invoice|$date|Your Order has been received
>
> Any suggestions would be helpful.
open OUT, ">> file.dat" or die "Could not open file.dat : $!";
print OUT "$invoice|$date|Your Order has been received\n";
close OUT;
Lao
Lao Coon Guest
-
Abigail #4
Re: Making a script write to a file (take 2)
Dave (prometheus_au@excite.com.au) wrote on MMMDCLVII September MCMXCIII
in <URL:news:526e114e.0309041747.7f0ec8aa@posting.goo gle.com>:
// G'day all
//
// I'm trying to get a script to write (append) data to the bottom line
// of a text file (*.dat). I know the variables I want to add but can't
// do it.
// I need to append something that looks like this...
//
// $invoice|$date|Your Order has been received
//
// Any suggestions would be helpful.
What have you tried so far?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==> "$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=* _;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)}; # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t( us(J())))))))))))))))))))))))
Abigail Guest
-
Dave #5
Re: Making a script write to a file (take 2)
Abigail <abigail@abigail.nl> wrote in message news:<slrnblgksg.6g7.abigail@alexandra.abigail.nl> ...
Abigail,>
> What have you tried so far?
>
>
> Abigail
I've been working on this.....
$orders_dat = "http//....path to file"
open(ORDERS,">>$orders_dat"); print ORDERS
"$invoice$delimiter$date$delimiter$processing_msg\ n"; close(ORDERS);
Cheers
Dave.
Dave Guest
-
Vlad Tepes #6
Re: Making a script write to a file (take 2)
Dave <prometheus_au@excite.com.au> wrote:
open() doesn't accept urls as arguments. If the file is on a remote> Abigail <abigail@abigail.nl>> I've been working on this.....>>
>
> $orders_dat = "http//....path to file"
>
> open(ORDERS,">>$orders_dat"); print ORDERS
> "$invoice$delimiter$date$delimiter$processing_msg\ n"; close(ORDERS);
system you can't use open().
If this is cgi, you must remember to lock your files. Otherwise
simultaneous updates might ruin your files. See 'perldoc -f flock'
for details on how to do this.
Regards,
--
Vlad
Vlad Tepes Guest
-
Philip #7
Re: Making a script write to a file (take 2)
> $orders_dat = "http//....path to file"
that's your problem. you need to use the real system path to the
file, not it's HTTP URL.
Philip Guest
-
Dave #8
Re: Making a script write to a file (take 2)
[email]drew@perlmad.com[/email] (Philip) wrote in message news:<9826ff94.0309092008.35913517@posting.google. com>...
so if I change it to....>> > $orders_dat = "http//....path to file"
> that's your problem. you need to use the real system path to the
> file, not it's HTTP URL.
$orders_dat = "/home/user/public_html/web/orders.dat"
open(ORDERS,">>$orders_dat");
print ORDERS
"$invoice$delimiter$date$delimiter$processing_msg\ n"; close(ORDERS);
It should work! I'll give it a whirl.
Thanks for the constructive criticism!
Dave.
Dave Guest
-
Tony Curtis #9
Re: Making a script write to a file (take 2)
>> On 11 Sep 2003 18:22:52 -0700,
>> [email]prometheus_au@excite.com.au[/email] (Dave) said:(An http URL does not refer to a file.)> [email]drew@perlmad.com[/email] (Philip) wrote in message
> news:<9826ff94.0309092008.35913517@posting.google. com>...>>>> > $orders_dat = "http//....path to file"
>> that's your problem. you need to use the real system
>> path to the file, not it's HTTP URL.
Don't forget you have to deal with locking.> so if I change it to....
> $orders_dat = "/home/user/public_html/web/orders.dat"
> open(ORDERS,">>$orders_dat"); print ORDERS
> "$invoice$delimiter$date$delimiter$processing_msg\ n";
> close(ORDERS);
> It should work! I'll give it a whirl. Thanks for the
> constructive criticism!
perldoc -q lock
hth
t
Tony Curtis Guest



Reply With Quote

