Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: how to delete part of the line?

by akho (Hermit)
on May 21, 2009 at 21:07 UTC ( #765548=note: print w/replies, xml ) Need Help??


in reply to how to delete part of the line?

General advice: use strictures and the 3-argument form of open. Something like this:
use strict; use warnings; open my $in, '<', 'infile'; open my $out, '>', 'outfile'; my @values; while (my $line = <$in>) { chomp $line; my ($value,) = $line =~ /^line\d+=(.+)/; push @values, $value if (defined $value); } print $out join('/', @values); close $in; close $out;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://765548]
help
Chatterbox?
[LanX]: obscure facts: only naturally born monks can become president here!
[cbeckley]: I have a functioning module I use to spawn sets of commands across multiple servers.
[cbeckley]: It's nascent, and probably looks like baby Perl to the veterans.
[cbeckley]: I have several questions about it's future development. But it seems like a lot of code to put in a sopw.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2017-03-24 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (304 votes). Check out past polls.