Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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;

Comment on Re: how to delete part of the line?
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2016-02-12 05:04 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (388 votes), past polls