Question: I am trying to do a simple thing , navigate to an external url

```
  <a href="http://18.217.228.108/angularapp1/book/"> Class Books  </a>

```

However I am getting a 404 because the Http// portion is being deleted I am not sure if this is an mvc thing or html thing. Here is link <http://18.217.228.108/angularapp1>.
Here is a link to a screen shot of me accessing url 

<https://gyazo.com/455b01f1ceded24f9b4ce6c58b0e10e1>

Answer: 
The simplest way is to split the string on `comma followed by a space` and then 
join the word groups with a `comma followed by a newline`.

```
my $x = "This a variable, start a new line here, This is a new line.";

print join(",\n", split /, /, $x) . "\n";

```

**output**

```
This a variable,
start a new line here,
This is a new line.

```

---

For solving the general, `how do I reformat this string with line breaks after n-columns?` problem, use the [Text::Wrap](https://perldoc.perl.org/Text/Wrap.html) library (as suggested by @ikegami):

```
use Text::Wrap;

my $x = "The quick brown fox jumped over the lazy dog.";

$Text::Wrap::columns = 15;

# wrap() needs an array of words
my @words = split /\s+/, $x;

# Initial tab, subsequent tab values set to '' (think indent amount)
print wrap('', '', @words) . "\n";

```

**output**

```
The quick
brown fox
jumped over
the lazy dog.

```
You probably want to use regular expressions. You can do this:

```
$x =~ s/^(\S+\s+){3}\K/\n/;

```

Or if this is about the commas and not the spaces:

```
$x =~ s/^([^,]+,+){2}\s*\K/\n/;

```

(in this case I also remove any potential space that would be after the comma)

You can also configure separately how many words or comma you want, by putting this in a variable:

```
my $nbwords = 7; # add a line after the 7th word
$x =~ s/^(\S+\s+){$nbwords}\K/\n/;

```

Now, that would keep the last space so you may want to do this:

```
my $nbwords = 7; # add a line after the 7th word
$nbwords--; # becomes 6 because there is another word after that we match as well
$x =~ s/^(\S+\s+){$nbwords}\S+\K\s+/\n/;

```

You should probably learn to use Regexps but just to explain the above:

* \s is any space character (like space, tab, line feed, etc)
* \S (uppercase) is any character except a space character
* + means any number of characters of that type described with what is before. So \s+ means any number of consecutive space characters.
* {123} means 123 times that type of character ...
* {3,80} means 3 to 80 times. So + is equivalent to {1,} (one to unlimited)
* \K means that whatever is before will not be replaced, only what is after.