Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 96043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:45:11+00:00 2026-05-10T23:45:11+00:00

I am trying to use the following code, which I have not been able

  • 0

I am trying to use the following code, which I have not been able to test yet, because I get the following errors:

#!/usr/bin/perl use warnings; use strict; use Text::Wrap; use Mail::Box::Manager; use HTML::Obliterate qw(extirpate_html);   open (MYFILE, '>>data.txt'); binmode(MYFILE, ':encoding(UTF-8)');   my $file = shift || $ENV{MAIL}; my $mgr = Mail::Box::Manager->new(     access          => 'r', );  my $folder = $mgr->open( folder => $file ) or die '$file: Unable to open: $!\n';  for my $msg ( sort { $a->timestamp <=> $b->timestamp } $folder->messages) {     my $to          = join( ', ', map { $_->format } $msg->to );     my $from        = join( ', ', map { $_->format } $msg->from );     my $date        = localtime( $msg->timestamp );     my $subject     = $msg->subject;     my $body        = $msg->decoded->string;   if ( $msg->isMultipart ) {     foreach my $part ( $msg->parts ) {         if ( $part->contentType eq 'text/html' ) {           my $nohtml = extirpate_html( $msg ); $body =~ s/^>.*$//msg; $Text::Wrap::columns=80; print MYFILE wrap('', '', <<''); \n From: $from To: $to Date: $date Subject: $subject \n $body         }  else {   $body =~ s/^>.*$//msg; $Text::Wrap::columns=80; print MYFILE wrap('', '', <<''); \n From: $from To: $to Date: $date Subject: $subject \n $body  }  }} 

All the braces seem to match up, so I am unsure what the problem is

syntax error at x.pl line 46, near 'else'   (Might be a runaway multi-line << string starting on line 36) Missing right curly or square bracket at x.pl line 63, at end of line syntax error at x.pl line 63, at EOF Execution of x.pl aborted due to compilation errors. 

edit:

it now works, but the html is not striped: instead a few emails with stuff like
>
> interlaced throughout, causing it to be many more pages than it should. Is there a better way to do this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:45:11+00:00Added an answer on May 10, 2026 at 11:45 pm

    So line 36 seems to be

    print MYFILE wrap('', '', <<''); 

    which means perl will wrap the following text until there is terminator '' (I never use confusing item like this, I always use END or UNTIL_END for simplicity.)

    That terminator is then found on line 45 (the empty line), meaning next thing it processes is line 46:

    else { 

    which doesn’t make sense, since the previous if hasn’t closed yet (the line 44 which has } is before the terminator '' so its treated as text for wrapping. Perl notices this and kindly suggest you this might be the culprit:

    (Might be a runaway multi-line << string starting on line 36) 

    You need to swap lines 44 and 45 to first have terminator '' (empty line), then close the if with }. The second wrap in your example does this correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use opengl in C#. I have following code which fails with
I'm trying to use the following code but it's returning the wrong day of
I am trying to use the following code to write data into an excel
I am trying to use the following code to export tables from access to
How do you concatenate bits in VHDL? I'm trying to use the following code:
I have been trying to use dynamic LINQ to Entity in my application for
I have been trying to use an ajax-style file upload component (like the dojox
I'm trying to use SDL in C++ with Visual Studio 2008 Express. The following
Trying to use an excpetion class which could provide location reference for XML parsing,
While trying to use LINQ to SQL I encountered several problems. I have table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.