Both will work (i.e. run without error) but the first form won't do what you're expecting due to operator precedence. The second form is preferable anyway because it is shorter, less complicated and easier to read. Take a look at the perlop manpage - under Conditional Operator for an explanation.
I suggest you write some test code for yourself rather than just asking whether this or that code will or won't work. You can do this sort of thing on the commandline:
ken@ganymede: ~/tmp
$ perl -Mstrict -Mwarnings -E 'my $x = 1 ? 1 : 0; say $x;'
1
ken@ganymede: ~/tmp
$ perl -Mstrict -Mwarnings -E 'my $x; 1 ? $x=1 : $x=0; say $x;'
0
ken@ganymede: ~/tmp
$ perl -Mstrict -Mwarnings -E 'my $x; 1 ? ($x=1) : ($x=0); say $x;'
1
ken@ganymede: ~/tmp
$