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 6963095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:44:43+00:00 2026-05-27T15:44:43+00:00

I have been encountering errors in Perl code that are reported at places which

  • 0

I have been encountering errors in Perl code that are reported at places which have nothing to do with the error. I fixed one such error after hours of removing and re adding code line by line and then doing some trial and error. Two such errors are detailed below. My question is : If these issues happen in future, is there a way to ensure that perl compiler helps me fix this OR do I have to rewrite the code in some other language. (am considering Java).

My program looks like this:

use switch;
use strict;
use warnings;
...other modules;
sub log{
}
..various sub routines
switch {$val1)
{
  log(..) #first invocation of log
  case ($val2)
...
}

Now within sub log if I do this

{
  $val3  = POSIX::floor($val2/$val4)*$val4;
  $val5="/x/y/$logfilename";
}

I get an error saying that there is an error at the case statement.
If I move the line $val5=”/x/y/$logfilename”; BEFORE $val3, there is no error.
OR if I remove the ‘/’ in $val5 i.e. $val5=”x”, there is no error
OR if I say $val5=qq(/x/y/$logfilename); there is no error.
This time I consider myself lucky that I found a workaround but it was only after 3 hours of fighting this. Is there a way to make perl compiler report the errors accurately?

I have one more similar case to report and can add if necessary.
Inputs solicited

  • 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. Editorial Team
    Editorial Team
    2026-05-27T15:44:43+00:00Added an answer on May 27, 2026 at 3:44 pm

    Ignoring the problems with your post, the issue you are probably running into is with the fact that the switch functionality in perl is implemented with a source filter. This basically means that the source code is preprocessed to convert what looks like a switch case structure into valid perl code before compilation. Perl’s parser usually gets line numbers a little wrong on complex structures, but when source filters are involved, all bets are off. This is one of the reasons that Switch has been deprecated in modern versions of Perl.

    The solution is to stop using switch, and either use Perl’s other control structures, or use a version of perl new enough to support the given/when construct (5.10+), which is modern Perl’s version of switch/case.

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

Sidebar

Related Questions

I have been encountering this error for my project, which involves working with Digital
Have been looking at the MVC storefront and see that IQueryable is returned from
I have been experimenting with woopra.com A web analytics tool. Which requires a piece
I have been encountering an issue with inserts in EF 4.0. During a migration
We have taken over some .NET 1.1 Windows Service code that spawns threads to
I have a database that has been populated with some data using create and
recently I have been encountering problems with exposing events from .NET to COM. I
I have been encountering issues with a custom WCF service deployed to SharePoint 2010.
Recently, I have been trying to accomplish creating a full-width jQuery slider that would
I have a webpage in which I have a div that I would like

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.