Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: How to remove the words before the dot using perl?

by finddata (Sexton)
on Mar 16, 2017 at 05:01 UTC ( #1184820=note: print w/replies, xml ) Need Help??


in reply to Re: How to remove the words before the dot using perl?
in thread How to remove the words before the dot using perl?

Here i had stored it in scalar vaiable i need to skip that part of the string using scalar variable.
  • Comment on Re^2: How to remove the words before the dot using perl?

Replies are listed 'Best First'.
Re^3: How to remove the words before the dot using perl?
by AnomalousMonk (Bishop) on Mar 16, 2017 at 05:07 UTC

    c:\@Work\Perl\monks>perl -wMstrict -le "my @files = qw(blah.config boo.config big.config); ;; for (@files) { my $scalar_variable = $_; printf qq{'$scalar_variable' -> }; $scalar_variable =~ s{ \A [^.]* }{}xms; print qq{'$scalar_variable'}; } " 'blah.config' -> '.config' 'boo.config' -> '.config' 'big.config' -> '.config'


    Give a man a fish:  <%-{-{-{-<

      its working fine
Re^3: How to remove the words before the dot using perl?
by nysus (Vicar) on Mar 16, 2017 at 05:07 UTC

    I'm not sure what you are saying but if you are just looking to do this on one scalar variable, get rid of the loop and replace $file with your variable:

    print ((split /\./, $your_variable)[-1] . "\n") ;

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1184820]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2020-01-20 08:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?