User Profile

Collapse

Profile Sidebar

Collapse
micwood
micwood
Last Activity: Nov 1 '07, 11:49 PM
Joined: Nov 1 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • micwood
    replied to Removing new line character from a string
    in Perl
    Whoops:
    that should be:
    $case{'judges'} =~ s/\n/ /g;

    not
    $case{'judges'} =~ s/\n/ /;


    But same transposed result as before.

    Thanks
    Michael
    See more | Go to post

    Leave a comment:


  • micwood
    replied to Removing new line character from a string
    in Perl
    Thanks for your help but I still am apparently breaking Perl. I tried your test and yes, it works. But when I try to apply it to my script, all hell breaks lose. At its most basic, this is my script:

    [code=perl]
    #!/usr/bin/perl -w
    my %case = (); # case hash
    my $judges = ''; # temp key
    open (IN, "/Users/MicWood/Documents/Perl/Opinion\ Scripts/output.txt");
    $/="";...
    See more | Go to post

    Leave a comment:


  • micwood
    replied to Removing new line character from a string
    in Perl
    I should also note that once i have isolated the entire string (with embedded "\n") to a hash value, say $case{'judges'} for example, and i try the following after the while (<>) loop:

    if (exists $case{'judges'} ){
    $case{'judges'} =~s/\n//g;}

    i get the following when i try to print $case{'judges'} :

    Justice Hudthis case.t participate in the consideration or decision of
    ...
    See more | Go to post

    Leave a comment:


  • micwood
    replied to Removing new line character from a string
    in Perl
    I have a simpler Perl question, but chomp doesn't seem to be doing the trick.

    I've input a file in paragraph mode (ie set $/="") as much of the data i need to isolate is multi-line. I have set up a while (<>) loop, in which I have several if statements to pattern match. I am saving long text strings into a hash but I need the values not to have any embedded "/n", such as:

    Justice Hudson did...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...