in reply to perl system command

That's what you get from passing a backslashed w od d to qq :
print qq{\d\w};

Double the backslashes, or use q instead, as you don't seem to need interpolation.

Moreover, calling perl from perl is usually not needed. Read the output of the command and process it in the script itself. What about using DBI instead of shelling out to mysql ?

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: perl system command
by cbtshare (Monk) on Nov 10, 2016 at 02:44 UTC
    Thank you double back-slashes worked. I am also using DBI module, but my issue is that I wanted to to split result and perl giving me issues. I have $row = $feed_db->fetchrow_array() ; $row is social_going_home , but I only want home, I tried grepping, but it only returns 1 (which means its found) .I can split it and store values into an array and search the array, but I want a one liner.can you help?
Re^2: perl system command
by cbtshare (Monk) on Nov 10, 2016 at 03:04 UTC
    So far in order to get what I want I have to split it and then search through it variable $row is "We_need_feed"
    my $row = $feed_db->fetchrow_array() ; my @words = split (/_/, $row); foreach(@words) { if(/feed*/) { $test="$_"; } } print("$test\n");

      Might something like this be helpful?

      c:\@Work\Perl\monks>perl -wMstrict -le "my $look_for = qr{ (?<! [[:alpha:]]) home (?! [[:alpha:]]) }xms; ;; my $row = 'social_going_home'; my $match = my ($capture) = $row =~ m{ (?<= _) $look_for \z }xmsg; ;; if ($match) { print qq{match, captured '$capture'}; } " match, captured 'home'

      Update: BTW: The pattern  feed* in the match of  if(/feed*/) { ... } matches any of  fee feed feedd feeddd ... Is that what you wanted?


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

        thank you , I will look at your code .Yes, I wanted feed and any words or digits after, because there is "feed001, feed002" etc
      in order to get what I want

      It isn't overly clear what you want. If you have a string with words separated by underscores and just want to return the last such word then you could do this:

      my $row = 'We_need_feed'; my ($last) = $row =~ /[^_]*$/g; print $last;

      or you could split and then pop but maybe extracting the last isn't what you want at all.

        thank you , I learned from your example. I wanted to extract just the word "feed", I was using my $result=$row=~/feed*/m but $result would just contain 0 or 1 which I read is expected, but your way gets the phrase.Thank you , but what does /^_*$/ do? You are saying you are searching for underscore at the front, followed by anything at the end? and what does the brackets [] do? Thank you