>>>>> "AB" == Alex Brelsfoard <[EMAIL PROTECTED]> writes:

  AB> I am currently trying to work on a system that reads in all kinds
  AB> of feeds.  These feeds can be created on a PC, new/old mac, or a
  AB> *nix machine.  And I need to be able to deal with them all.
  AB> Here's the kicker, these feeds sometimes have inline breaks, and
  AB> we need to keep them.

  AB> ---------------------------
  AB> my $newline = "\n";
  AB> my $file = '788_test.txt';
  AB> open (my $file_fh, $file) || die "could not open $file for reading";
  AB> my $file_content = <$file_fh>;

that only reads in one line. did you undef $/ ? or you can use
file::slurp and then split.
  AB> $file_content =~ s/(?:\015{1,2}\012|\015|\012)/$newline/sg;

much cleaner and faster:

        $file_content =~ tr/\015\012/\n/s ;

  AB> foreach (split(/\n/, $file_content)) {

that will make a list of all the lines which may be inefficient. i dunno
the size of your files.

  AB> I can even split on that regular expression.
  AB> But I'm just concerned about losing inline breaks.

define inline break. it can't be a newline or CR as those define
lines. you need clearer specs and data examples if you want more help.

thanx,

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to