I'd thought I'd seen everything with perl until I saw John Krahn give
this code as a solution:

#syntax:  unfold.pl filename > newfilename

@ARGV or die "usage: $0 filename\n";
$/ = ''; print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>;


I've never seen grep used with [ ] brackets before - it works the same
with { }:

print for grep { chomp, s/\n\s+/ /g, s/\z/\n\n/ } <>;

How do the brackets fit into the "grep EXPR, LIST" form given in the
docs?

Thanks!
Luke

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to