Home > Archive > PERL Miscellaneous > November 2005 > FAQ 5.17 How can I open a file with a leading ">" or trailing blanks?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
FAQ 5.17 How can I open a file with a leading ">" or trailing blanks?
|
|
| PerlFAQ Server 2005-11-03, 6:59 pm |
| This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
5.17: How can I open a file with a leading ">" or trailing blanks?
(contributed by Brian McCauley)
The special two argument form of Perl's open() function ignores trailing
blanks in filenames and infers the mode from certain leading characters
(or a trailing "|"). In older versions of Perl this was the only version
of open() and so it is prevalent in old code and books.
Unless you have a particular reason to use the two argument form you
should use the three argument form of open() which does not treat any
charcters in the filename as special.
open FILE, "<", " file "; # filename is " file "
open FILE, ">", ">file"; # filename is ">file"
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
| |
| Brian McCauley 2005-11-23, 6:58 pm |
|
PerlFAQ Server wrote:
>
> 5.17: How can I open a file with a leading ">" or trailing blanks?
>
> (contributed by Brian McCauley)
> Copyright (c) 1997-2002 Tom Christiansen and Nathan
> Torkington, and other contributors as noted.
IMNSHO attibutions detract from the flow FAQ.
I think it would be better to place a list of contributors at the end.
Anyhow, in cases were a contibution is a less than total re-write of an
answer the correct attribution may be somewhat blurred.
Obviously any contribution made to Perl or it's standard docs must be
covered by Perl's license.
| |
| brian d foy 2005-11-24, 6:57 pm |
| [[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <1132774385.951279.117480@g14g2000cwa.googlegroups.com>,
Brian McCauley <nobull67@gmail.com> wrote:
> PerlFAQ Server wrote:
>
[color=darkred]
> I think it would be better to place a list of contributors at the end.
I need to keep track of who contributed what, and that's the easiest
way to do it.
Since I post the FAQ answers individually, I also don't
want to give the impression that either Tom or Nat wrote the answer
when they may have had nothing to do with it.
Additionally, I think the people who contributed should have to take
responsibility for the parts they added.
--
brian d foy, bdfoy@cpan.org
Subscribe to The Perl Review: http://www.theperlreview.com
| |
| Brian McCauley 2005-11-24, 6:57 pm |
|
brian d foy wrote:
> Brian McCauley <nobull67@gmail.com> wrote:
>
>
> I need to keep track of who contributed what, and that's the easiest
> way to do it.
> Additionally, I think the people who contributed should have to take
> responsibility for the parts they added.
OK, fair enough.
| |
| robic0 2005-11-26, 7:56 am |
| On 24 Nov 2005 09:40:37 -0800, "Brian McCauley" <nobull67@gmail.com>
wrote:
>
>brian d foy wrote:
>
>
>OK, fair enough.
I am also interrested in this information. It would be welcome to have
a FAQ on the FAQ. The details, like who what where and the numbering
convention and possibly a Table of Contents. Why publish the numbering
convention, which is all over the place, if people don't know what or
where the larger referrence is, as well.
| |
| brian d foy 2005-11-26, 6:58 pm |
| In article <fapgo1h4eml84r1ld73tvj2011ulqn163f@4ax.com>, robic0 wrote:
> I am also interrested in this information. It would be welcome to have
> a FAQ on the FAQ. The details, like who what where and the numbering
> convention and possibly a Table of Contents. Why publish the numbering
> convention, which is all over the place, if people don't know what or
> where the larger referrence is, as well.
The FAQs come from the perlfaq documents distributed with Perl. The
table of contents in the perlfaq manual page.
--
brian d foy, bdfoy@cpan.org
Subscribe to The Perl Review: http://www.theperlreview.com
| |
| robic0 2005-11-27, 9:56 pm |
| On Sat, 26 Nov 2005 10:33:17 -0600, brian d foy <comdog@panix.com>
wrote:
>In article <fapgo1h4eml84r1ld73tvj2011ulqn163f@4ax.com>, robic0 wrote:
>
>
>The FAQs come from the perlfaq documents distributed with Perl. The
>table of contents in the perlfaq manual page.
Ok, thanks!
|
|
|
|
|