Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

(zdog) Re: Manipulating Output

by zdog (Priest)
on Jul 09, 2002 at 15:56 UTC ( #180527=note: print w/ replies, xml ) Need Help??


in reply to Manipulating Output

Here are a few comments on your existing code:

use strict; # always 'use strict' use warnings; # always 'use warnings' or the -w switch chomp (my @a = <DATA>); # chomp the array to get rid of extra \n's my $file = "bas.txt"; # get the open() out of the loop so it's not repeated unnecessarily open (FILE, ">>$file") || die "Can't open $file: $! \n"; print FILE "$_\n" for @a; # shorter; sweeter close(FILE); close(DATA); __DATA__ 222.222.333.444:firstServer 121.222.222.222:secondServer

I know that I'm not answering your question (it's been done), but those are a few other things to keep in mind for the future.

Zenon Zabinski | zdog | zdog@perlmonk.org


Comment on (zdog) Re: Manipulating Output
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://180527]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2015-07-07 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls