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

Re: split a line by control ^D character

by karlgoethebier (Vicar)
on Dec 02, 2012 at 18:37 UTC ( #1006743=note: print w/ replies, xml ) Need Help??

in reply to split a line by control ^D character


#!/usr/bin/perl + use strict; use warnings; use IO::All; my $io = io( shift ) || die $!; for ( $io->getlines ) { print join( qq(|), split /\x04/ ); } __END__ Karls-Mac-mini:monks karl$ perl -e 'for( 1..3 ){ print qq(foo\x04bar\x +04baz\n) };' > records.dat Karls-Mac-mini:monks karl$ cat records.dat foobarbaz foobarbaz foobarbaz Karls-Mac-mini:monks karl$ ./ records.dat + foo|bar|baz + foo|bar|baz + foo|bar|baz + + +

See IO::All

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Comment on Re: split a line by control ^D character
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2015-07-07 14:52 GMT
Find Nodes?
    Voting Booth?

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

    Results (90 votes), past polls