l[v_]:=Sqrt[v.v]; proj[v_,w_]:=w (v.w)/(w.w); 
scalarproj[v_,w_]:=l[proj[v,w]];
v0={3,4,5}; w0={4,5,1}; scalarproj[v0,w0]
