🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #52609

Re: How to save output

#52609
From: Julian Gilbey
Date: Fri, 30 Oct 1998 15:24
39 lines
2216 bytes
Joseph Dirmeyer wrote:
> 
> This perl script shows me what txt, htm, html Files I have in my Temp
> directory.
> Does anyone know what I have to do that this Information will be
> saved in a File. e.g. in directory.txt
> 
> use File::Find;
> my $start_dir = '/temp';
> 
> find( sub {
> if (   -T  "$File::Find::name"   ) {
> print  "menuData.add(new
> top.LinkNode(\"$File::Find::$_\",\"$File::Find::name\"));\n";
> [...]

Firstly, this question only needed to go to comp.lang.perl.misc,
no to about a dozen groups.

The print command can be used to print to a filehandle.  So:

open (OUTFILE,">directory.txt") or die "Can't open output file!";

and then use:

print OUTFILE "menuData.add(new...

etc.

HTH,

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            Julian Gilbey             Email: J.D.Gilbey@qmw.ac.uk
       Dept of Mathematical Sciences, Queen Mary & Westfield College,
                  Mile End Road, London E1 4NS, ENGLAND
      -*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-
Technical Details
Message-ID: <3639DA21.7D53F93F@qmw.ac.uk>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!newshub.northeast.verio.net!newspeer.monmouth.com!peer.news.zetnet.net!peer.news.bb.u-net.net!u-net!newsr2.u-net.net.POSTED!not-for-mail
References: <363875C3.B942985D@gmx.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!newshub.northeast.verio.net!newspeer.monmouth.com!peer.news.zetnet.net!peer.news.bb.u-net.net!u-net!newsr2.u-net.net.POSTED!not-for-mail
Message-ID: <3639DA21.7D53F93F@qmw.ac.uk>
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Organization: Queen Mary and Westfield College, U. of London
X-Mailer: Mozilla 3.04 (X11; U; Linux 2.0.34 i586)
MIME-Version: 1.0
Newsgroups: comp.lang.perl,de.comp.lang.perl,eug.comp.lang.perl,fj.lang.perl,fr.comp.lang.perl,it.comp.lang.perl,japan.comp.lang.perl,pl.comp.lang.perl,tw.bbs.comp.lang.perl,microsoft.public.inetsdk.programming.hyperlnkng_api,microsoft.public.activex.programming.hyperlinking
Subject: Re: How to save output
References: <363875C3.B942985D@gmx.de>
Lines: 39
Date: Fri, 30 Oct 1998 15:24:17 +0000
NNTP-Posting-Host: 195.102.195.47
X-Complaints-To: news@u-net.net
X-Trace: newsr2.u-net.net 909761254 195.102.195.47 (Fri, 30 Oct 1998 15:27:34 BST)
NNTP-Posting-Date: Fri, 30 Oct 1998 15:27:34 BST
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit