Search code examples
windowsperlsystemmetacharacters

How to open browser on windows with url which contains metacharacters


I tried to open browser with different ways something like this

system('start ' . $url) or use special module Browser::Open He opened url , but not all , only http://host.com/cgi-bin/nagios3/status.cgi?hostgroup=all

I forgot to notice , i need to open http://host.com/cgi-bin/nagios3/status.cgi?hostgroup=all&style=detail&servicestatustypes=28&sorttype=2&sortoption=3


Solution

  • & has special meaning for the shell, so you need to place the URL in quotes.

    But start has a very unusual syntax. If the first argument is in quotes, it's taken to be the title of the Window. So you need to add a dummy first argument. The solution follows:

    system(qq{start "" "$url"})