CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
$var =~ s|,$|| command

 



TClayJ
New User

May 24, 2016, 11:37 AM

Post #1 of 2 (2989 views)
$var =~ s|,$|| command Can't Post

I've been given the job of supporting some perl applications and I'm trying to figure out what this line of code is trying to do given this type of input. A tar file is being processed and give this code what is suppose to be assigned to $var based on the tar file looking like...

dir1/
dir1/file1.gz
dir1/file2.gz
dir1/file3.gz
dir1/file4.gz

open ( T, "tar -xvf test.tar" ) || die "cannot open";
while(<T>) {
my ( $x, $var ) = split();
$var =~ s|,$||;
}


(This post was edited by TClayJ on May 24, 2016, 11:49 AM)


Laurent_R
Veteran / Moderator

May 24, 2016, 2:01 PM

Post #2 of 2 (2986 views)
Re: [TClayJ] $var =~ s|,$|| command [In reply to] Can't Post

It seems that it is trying to remove any comma at the end of the $var string.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives