-1

i'd like to split string with two or more ">", split function should brake string in first ">" and others put to second sting in list.

i try

$text = "tobash> hubba -> http://nonexists100101.net";

@op = split(/>{1}/, $text);

but split still breaks in every ">"

Mr. NoNe
  • 53
  • 1
  • 8

1 Answers1

3

This is not how {1} works (in fact, {1} never does anything at all). According to perldoc split has a third limit parameter. Try:

split(/>/, $text, 2)

That will return at most 2 substrings.

Martin Ender
  • 43,427
  • 11
  • 90
  • 130