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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:48:36+00:00 2026-05-25T09:48:36+00:00

I am trying to create a file path out of a predetermined path and

  • 0

I am trying to create a file path out of a predetermined path and a variable which is a folder inside the pre determined path.

The predetermined part of the path is /sys/kernel/scst_tgt/targets/iscsi/

The next folder is an address for an iSCSI target like iqn.2011-08.com.solignis:datastore2

Then the last part is something like /enabled which is a file that tells the state of the target.

When I try to print the full path with the variable $target_name being replaced with the name of the iSCSI target. The resulting output looks like this

/sys/kernel/scst_tgt/targets/iscsi/iqn.2011-08.com.solignis:datastore2
/enabled

It puts the enabled part on a new line. I can’t figure out what is going on

Here is the code for the sub routine I was working on:

sub target_enabled {
    my $target_name = shift;
    my $target_state_file = "/sys/kernel/scst_tgt/targets/iscsi/$target_name/enabled";
    print "$target_state_file\n";
}
  • 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-25T09:48:37+00:00Added an answer on May 25, 2026 at 9:48 am

    Looks like you have a newline at the end of $target_name. So:

    chomp $target_name;
    

    And if that doesn’t work (because you may have for example \r\n from a windows file):

    $target_name =~ s/\s+\z//;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying out to create a regular expression to match file path in
I am trying to create a record containing the path to a file. The
I'm trying to create a folder and create a file within it. Whenever i
I'm trying to create a function in c which scans all my path C:
Here's an idea. I'm trying to create file from PHP script. File may be
I am trying to create a file in the /tmp directory (working on a
I am trying to create a file using File newFile = new File(myFile); However
I am just trying to create a file with QProcess by the following source
I am trying to create an XML file based on data fields from a
I'm trying to create a Zip file from .Net that can be read from

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.