Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^2: giving spaces

by Anonymous Monk
on Jul 17, 2013 at 04:54 UTC ( #1044711=note: print w/replies, xml ) Need Help??

in reply to Re: giving spaces
in thread giving spaces

say I have two arrays , arrayA and arrayB . and I wish to print something like this

print " \s $arrayA[$i] \s $arrayB[$i] \s";

I have assumed that \s is giving space , so I just want , what should i replace $s with ?

Replies are listed 'Best First'.
Re^3: giving spaces
by mtmcc (Hermit) on Jul 17, 2013 at 07:46 UTC
    If that's what you want to print, you don't need any space regex.

    print " $arrayA[$x] $arrayB[$x] ";

    will print the spaces too...

    I hope that helps.

Re^3: giving spaces
by BillKSmith (Vicar) on Jul 17, 2013 at 14:09 UTC
    If you use use strict; use warnings; you will probably find an error in this statement that has nothing to do with spaces. I suspect that you intend $i to be a subscript. If so,
    print " $arrayA[$i] $arrayB[$i] ";
    Note: \s is special character class for regular expressions. It does not have the same meaning in a string. Just use space characters.
Re^3: giving spaces
by Anonymous Monk on Jul 17, 2013 at 05:25 UTC
    $var1." ".$var2;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044711]
[Corion]: Meh... Github (understandably) doesn't allow files larger than 100MB, but my rebase of an older repo (from Github) includes such a file and now I can't push my changes there
[Corion]: Maybe that is the push I need to finally try out Gitprep ;)
[Corion]: On the upside, I should finally improve Image::CCV to also do ImageNet classification using their pretrained parameters
[Lady_Aleena]: Hello Corion.
[Corion]: Hi Lady_Aleena!

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2017-09-24 18:05 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (274 votes). Check out past polls.