Re: How to I create a file?

2017-03-21 Thread ToddAndMargo
On 03/21/2017 04:27 AM, Philip Hazelden wrote: $PathAndName.IO.f or $PathAndName.IO.open(:w).close; Note, the following sequence is possible: 1. .IO.f returns false 2. Someone creates the file and writes some data to it 3. .IO.open truncates the file Thus, this has a chance of editing the

Re: How to I create a file?

2017-03-21 Thread Philip Hazelden
> $PathAndName.IO.f or $PathAndName.IO.open(:w).close; Note, the following sequence is possible: 1. .IO.f returns false 2. Someone creates the file and writes some data to it 3. .IO.open truncates the file Thus, this has a chance of editing the file. I suggest instead (untested):

Re: How to I create a file?

2017-03-21 Thread ToddAndMargo
On 03/21/2017 04:02 AM, Simon Proctor wrote: It's a logical test but I'd probably use || instead. Thank you!

Re: How to I create a file?

2017-03-21 Thread Simon Proctor
It's a logical test but I'd probably use || instead. See : https://docs.perl6.org/language/traps#Loose_boolean_operators On Tue, 21 Mar 2017 at 10:56 ToddAndMargo wrote: > On 03/21/2017 03:07 AM, Brent Laabs wrote: > > $PathAndName.IO.f or

Re: How to I create a file?

2017-03-21 Thread ToddAndMargo
On 03/21/2017 03:07 AM, Brent Laabs wrote: $PathAndName.IO.f or $PathAndName.IO.open(:w).close; Is that a coding "or" or an English "or"? -- ~~ Computers are like air conditioners. They malfunction when you open windows

Re: How to I create a file?

2017-03-21 Thread ToddAndMargo
On 03/21/2017 03:50 AM, Simon Proctor wrote: .e checks a path exists. .f checks it exists AND is a file. .d checks it exists AND is a directory. (Perl 5 was the -e, -f and -d tests) Beautiful explanation! Thank you! Perl 5 has the (about) same test as bash and I write a lot in that too. (I

Re: How to I create a file?

2017-03-21 Thread Simon Proctor
.e checks a path exists. .f checks it exists AND is a file. .d checks it exists AND is a directory. (Perl 5 was the -e, -f and -d tests) On Tue, 21 Mar 2017 at 10:19 ToddAndMargo wrote: > On 03/21/2017 03:07 AM, Brent Laabs wrote: > > You can create a file by opening a

Re: How to I create a file?

2017-03-21 Thread ToddAndMargo
On Tue, Mar 21, 2017 at 3:01 AM, ToddAndMargo > wrote: Hi All, How to I do this bash code in Perl 6? if [ ! -f "$PathAndName" ]; then touch "$PathAndName" fi I am not finding the directions on how to create a "new" file

Re: How to I create a file?

2017-03-21 Thread Brent Laabs
You can create a file by opening a filehandle for writing. $PathAndName.IO.f or $PathAndName.IO.open(:w).close; On Tue, Mar 21, 2017 at 3:01 AM, ToddAndMargo wrote: > Hi All, > > How to I do this bash code in Perl 6? > > if [ ! -f "$PathAndName" ]; then touch

How to I create a file?

2017-03-21 Thread ToddAndMargo
Hi All, How to I do this bash code in Perl 6? if [ ! -f "$PathAndName" ]; then touch "$PathAndName" fi I am not finding the directions on how to create a "new" file at a specific location. Many thanks, -T -- ~~ Computers are like air conditioners. They