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

  • Home
  • SEARCH
  • 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 8278379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:59:22+00:00 2026-06-08T08:59:22+00:00

I’m a little noobish to perl coding conventions, could someone help explain: why are

  • 0

I’m a little noobish to perl coding conventions, could someone help explain:

  • why are there / and /< in front of perl variables?
  • what does\= and =~ mean, and what is the difference?
  • why does the code require an ending / before the ;, e.g. /start=\'([0-9]+)\'/?

The 1st 3 sub-questions were sort of solved by really the perldocs, but what does the following line means in the code?

push(@{$Start{$start}},$features);

i understand that we are pushing the $features into a @Start array but what does @$Start{$start} mean? Is it the same as:
@Start = ($start);

Within the code there is something like this:

use FileHandle;

sub open_infile {
  my $file = shift;
  my $in = FileHandle->new($file,"<:encoding(UTF-8)")
      or die "ERROR: cannot open $file: $!\n" if ($Opt_utf8);
  $in = new FileHandle("$file")
      or die "ERROR: cannot open $file: $!\n" if (!$Opt_utf8);
  return $in;
}

$uamf = shift @ARGV;
$uamin = open_infile($uamf);


while (<$uamin>) {
    chomp;
    if(/<segment /){
        /start=\'([0-9]+)\'/;
        /end=\'([0-9]+)\'/;
        /features=\'([^\']+)\'/;
        $features =~ s/annotation;//;

    push(@{$Start{$start}},$features); 
    push(@{$End{$end}},$features); 
    }
}

EDITED

So after some intensive reading of the perl doc, here’s somethings i’ve gotten

  • The /<segment / is a regex check that checks whether the readline
    in while (<$uamin>) contains the following string: <segment.
  • Similarly the /start=\'([0-9]+)\'/ has nothing to to do with
    instantiating any variable, it’s a regex check to see whether the
    readline in while (<$uamin>) contains start=\'([0-9]+)\' which
    \'([0-9]+)\' refers to a numeric string.
  • In $features =~ s/annotation;// the =~ is use because the string
    replacement was testing a regular expression match. See
    What does =~ do in Perl?
  • 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-06-08T08:59:24+00:00Added an answer on June 8, 2026 at 8:59 am

    Where did you see this syntax (or more to the point: have you edited stuff out of what you saw)? /foo/ represents the match operator using regular expressions, not variables. In other words, the first line is checking to see if the input string $_ contains the character sequence <segment.

    The subsequent three lines essentially do nothing useful, in the sense that they run regular expression matches and then discard the results (there are side-effects, but subsequent regular expressions discard the side-effects, too).

    The last line does a substitution, replacing the first occurance of the characters annotation; with the empty string in the string $features.

    Run the command perldoc perlretut to learn about regex in Perl.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I know there's a lot of other questions out there that deal with this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.